#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int n, m, q, a[N * 2], b[N], par[N][20], pos[N], pre[N], ans[N], l, r;
vector<int> v[N];
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> m >> q;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 1; i <= n; i++) {
    pre[a[i % n + 1]] = a[i];
  }
  for (int i = 1; i <= m; i++) {
    cin >> b[i];
  }
  for (int i = 1; i <= m; i++) {
    par[i][0] = pos[pre[b[i]]];
    pos[b[i]] = i;
  }
  for (int i = 1; i <= m; i++) {
    for (int j = 1; j <= 18; j++) {
      par[i][j] = par[par[i][j - 1]][j - 1];
    }
  }
  for (int i = 1; i <= m; i++) {
    int x = i;
    for (int j = 0; j <= 18; j++) {
      if (1 << j & n - 1) x = par[x][j];
    }
    ans[i] = max(ans[i - 1], x);
  }
  while (q--) {
    cin >> l >> r;
    if (ans[r] >= l)
      cout << 1;
    else
      cout << 0;
  }
}
