#include <bits/stdc++.h>
using namespace std;
set<int> s1[200050];
int nxt[200050], ed[200050], a[200050], b[200050], f[200050][25];
int geted(int w, int n) {
  for (int i = 40; i >= 0; i--)
    if (n >= (1ll << i)) {
      w = f[w][i];
      n -= (1 << i);
    }
  return w;
}
int main() {
  int n, m, q;
  scanf("%d %d %d", &n, &m, &q);
  memset(ed, 0x7f, sizeof(ed));
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i < n; i++) nxt[a[i]] = a[i + 1];
  nxt[a[n]] = a[1];
  for (int i = 1; i <= m; i++) {
    scanf("%d", &b[i]);
    s1[b[i]].insert(i);
  }
  for (int i = 1; i <= m; i++) {
    int k = *s1[nxt[b[i]]].upper_bound(i);
    if (k < i)
      f[i][0] = 0;
    else if (k <= m)
      f[i][0] = k;
  }
  for (int i = 1; (1 << i) <= n; i++)
    for (int j = 1; j <= m; j++) f[j][i] = f[f[j][i - 1]][i - 1];
  ed[m] = geted(m, n - 1);
  if (ed[m] == 0) ed[m] = m + 1;
  for (int j = m - 1; j >= 1; j--) {
    ed[j] = geted(j, n - 1);
    if (ed[j] == 0) ed[j] = m + 1;
    ed[j] = min(ed[j], ed[j + 1]);
  }
  for (int i = 1; i <= q; i++) {
    int x, y;
    scanf("%d %d", &x, &y);
    if (ed[x] <= y && ed[x] > 0)
      printf("1");
    else
      printf("0");
  }
}
