#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5, M = 18;
int n, m, q;
int p[N], arr[N], to[N], segTree[4 * N];
int nxt[N], last[N], Pend[N];
int par[N][M];
void build1() {
  memset(par, -1, sizeof par);
  for (int i = 0; i < m; i++) par[i][0] = nxt[i];
  for (int j = 1; j < M; j++)
    for (int i = 0; i + (1 << j) - 1 < m; i++)
      if (~par[i][j - 1]) par[i][j] = par[par[i][j - 1]][j - 1];
}
int get(int node, int k) {
  for (int j = 0; j < 30 && ~node; j++)
    if (k & (1 << j)) node = par[node][j];
  return node;
}
void build2(int l = 0, int r = m - 1, int pos = 1) {
  if (l == r) {
    segTree[pos] = ~Pend[l] ? Pend[l] : 1e9;
    return;
  }
  int mid = (l + r) / 2;
  build2(l, mid, pos * 2);
  build2(mid + 1, r, pos * 2 + 1);
  segTree[pos] = min(segTree[pos * 2], segTree[pos * 2 + 1]);
}
int RMQ(int s, int e, int l = 0, int r = m - 1, int pos = 1) {
  if (l > e || r < s) return 1e9;
  if (l >= s && r <= e) return segTree[pos];
  int mid = (l + r) / 2;
  return min(RMQ(s, e, l, mid, pos * 2), RMQ(s, e, mid + 1, r, pos * 2 + 1));
}
int main() {
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 0; i < n; i++) {
    scanf("%d", p + i);
    if (i) to[p[i - 1]] = p[i];
  }
  to[p[n - 1]] = n == 1 ? 2 : p[0];
  for (int i = 0; i < m; i++) scanf("%d", arr + i);
  memset(last, -1, sizeof last);
  for (int i = m - 1; i >= 0; i--) {
    last[arr[i]] = i;
    nxt[i] = last[to[arr[i]]];
  }
  build1();
  for (int i = 0; i < m; i++) Pend[i] = get(i, n - 1);
  build2();
  int s, e;
  while (q--) {
    scanf("%d%d", &s, &e);
    putchar(RMQ(s - 1, e - 1) < e ? '1' : '0');
  }
}
