#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 7;
const int inf = INT_MAX;
const long long inff = 1e18;
const long long mod = 1e9 + 7;
int n, m, q;
int a[maxn], b[maxn];
int nex[maxn], tmp[maxn];
int p[maxn][20];
int A[maxn];
int seg[maxn * 4];
void Build(int node, int l, int r) {
  if (l == r) {
    seg[node] = A[l];
    return;
  }
  int M = (l + r) >> 1;
  Build(node * 2, l, M);
  Build(node * 2 + 1, M + 1, r);
  seg[node] = min(seg[node * 2], seg[node * 2 + 1]);
}
int query(int node, int l, int r, int ql, int qr) {
  if (r < ql || l > qr)
    return inf;
  else if (l >= ql && r <= qr)
    return seg[node];
  int M = (l + r) >> 1;
  return min(query(node * 2, l, M, ql, qr),
             query(node * 2 + 1, M + 1, r, ql, qr));
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m >> q;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) {
    if (i == n)
      nex[a[i]] = a[1];
    else
      nex[a[i]] = a[i + 1];
  }
  for (int i = 1; i <= m; i++) cin >> b[i];
  for (int i = m; i >= 1; i--) {
    if (tmp[nex[b[i]]] == 0)
      p[i][0] = inf;
    else
      p[i][0] = tmp[nex[b[i]]];
    tmp[b[i]] = i;
  }
  for (int i = 1; i <= 19; i++)
    for (int j = 1; j <= m; j++) {
      if (p[j][i - 1] == inf)
        p[j][i] = inf;
      else
        p[j][i] = p[p[j][i - 1]][i - 1];
    }
  for (int i = 1; i <= m; i++) {
    int ttmp = n - 1, now = i;
    for (int j = 19; j >= 0; j--) {
      if (ttmp & (1 << j)) {
        if (now == inf)
          ;
        else
          now = p[now][j];
      }
    }
    A[i] = now;
  }
  Build(1, 1, m);
  string s;
  while (q--) {
    int l, r;
    cin >> l >> r;
    if (query(1, 1, m, l, r) <= r)
      s += "1";
    else
      s += "0";
  }
  cout << s << endl;
}
