#include <bits/stdc++.h>
using namespace std;
const int N = 200001;
int n, m, q, r[N][20];
vector<int> p, a;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m >> q;
  vector<int> nex(n);
  for (int i = 0, x; i < n && cin >> x; i++) {
    x--;
    if (i > 0) nex[p.back()] = x;
    p.push_back(x);
  }
  nex[p.back()] = p[0];
  for (int i = 0, x; i < m && cin >> x; i++) a.push_back(x - 1);
  vector<int> las(n, m), ans(m + 1, m);
  for (int i = 0; i < 20; i++) r[m][i] = m;
  ans[m] = m;
  for (int i = m - 1; i >= 0; i--) {
    r[i][0] = las[nex[a[i]]];
    las[a[i]] = i;
    for (int j = 1; j < 20; j++) r[i][j] = r[r[i][j - 1]][j - 1];
    int g = n - 1;
    int cur = i;
    for (int j = 19; j >= 0; j--) {
      if ((1 << j) > g) continue;
      cur = r[cur][j];
      g -= (1 << j);
    }
    ans[i] = min(cur, ans[i + 1]);
  }
  while (q--) {
    int l, r;
    cin >> l >> r;
    l--;
    r--;
    cout << (ans[l] <= r);
  }
  cout << endl;
}
