#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
const int inf = 0x3f3f3f3f;
const int mod = 1e9 + 7;
int pre[maxn], last[maxn];
int b[maxn], a[maxn], fa[maxn][21], lpos[maxn];
int m, n, q;
int jump(int u, int m) {
  for (int i = 0; i <= 20; ++i) {
    if ((m >> i) & 1) u = fa[u][i];
  }
  return u;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> m >> n >> q;
  for (int i = 1; i <= m; ++i) cin >> b[i];
  for (int i = 1; i <= n; ++i) cin >> a[i];
  pre[b[m]] = b[m - 1];
  for (int i = 1; i < m; ++i) {
    pre[b[i]] = b[(i - 1 - 1 + m) % m + 1];
  }
  for (int i = 1; i <= n; ++i) {
    fa[i][0] = last[pre[a[i]]];
    for (int j = 1; j <= 20; ++j) fa[i][j] = fa[fa[i][j - 1]][j - 1];
    last[a[i]] = i;
  }
  for (int i = n; i >= 1; --i) {
    lpos[i] = jump(i, m - 1);
  }
  for (int i = 1; i <= n; ++i) {
    lpos[i] = max(lpos[i], lpos[i - 1]);
  }
  while (q--) {
    int l, r;
    cin >> l >> r;
    cout << (lpos[r] >= l ? '1' : '0');
  }
  cout << endl;
  return 0;
}
