#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int a[N], b[N], nex[N], last[N], ans[N];
int dp[N][20];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, m, q;
  cin >> n >> m >> q;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 1; i <= m; i++) {
    cin >> b[i];
  }
  nex[a[n]] = 1;
  for (int i = 1; i < n; i++) {
    nex[a[i]] = i + 1;
  }
  fill(last, last + n + 1, m + 1);
  for (int i = 1; i <= m + 1; i++) fill(dp[i], dp[i] + 20, m + 1);
  for (int i = m; i >= 1; i--) {
    dp[i][0] = last[a[nex[b[i]]]];
    last[b[i]] = i;
    for (int j = 1; j < 20; j++) {
      dp[i][j] = dp[dp[i][j - 1]][j - 1];
    }
  }
  for (int i = 1; i <= m; i++) {
    int l = n - 1, p = i;
    for (int j = 20; ~j; j--) {
      if (l >= (1 << j)) {
        l -= 1 << j;
        p = dp[p][j];
      }
    }
    ans[i] = p;
  }
  for (int i = m - 1; i >= 1; i--) {
    ans[i] = min(ans[i], ans[i + 1]);
  }
  for (int i = 0; i < q; i++) {
    int l, r;
    cin >> l >> r;
    cout << (r >= ans[l]);
  }
  cout << endl;
  return 0;
}
