#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int a[N], b[N], fa[N][31], pre[N], pos[N], lef[N];
int main() {
  int n, m, q;
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]), pre[a[i]] = a[i - 1];
  pre[a[1]] = a[n];
  for (int i = 1; i <= m; i++) scanf("%d", &b[i]);
  for (int i = 1; i <= m; i++) fa[i][0] = pos[pre[b[i]]], pos[b[i]] = i;
  for (int j = 1; j <= 30; j++)
    for (int i = 1; i <= m; i++) fa[i][j] = fa[fa[i][j - 1]][j - 1];
  for (int i = 1; i <= m; i++) {
    int res = n - 1, ct = 30, now = i;
    while (res) {
      while (res < (1 << ct)) ct--;
      res -= (1 << ct);
      now = fa[now][ct];
    }
    lef[i] = max(now, lef[i - 1]);
  }
  string ans = "";
  while (q--) {
    int l, r;
    scanf("%d%d", &l, &r);
    if (lef[r] >= l)
      ans += "1";
    else
      ans += "0";
  }
  cout << ans << endl;
}
