#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
const int maxn = 18;
void ConstructJumpTo(vector<int>& pre, vector<int>& a,
                     vector<vector<int> >& jump_to) {
  int m = a.size();
  vector<int> latest(pre.size(), 0);
  for (int i = 1; i < m; i++) {
    int cur_val = a[i];
    int pre_val = pre[cur_val];
    jump_to[0][i] = latest[pre_val];
    latest[cur_val] = i;
  }
  for (int k = 1; k < maxn; k++) {
    for (int i = 1; i < m; i++) {
      int lower_order = jump_to[k - 1][i];
      jump_to[k][i] = jump_to[k - 1][lower_order];
    }
  }
}
void FindMaxLeft(int n, vector<vector<int> >& jump_to, vector<int>& max_left) {
  int m = max_left.size();
  for (int i = 1; i < m; i++) {
    int cur_pos = i;
    int base = 1;
    for (int k = 0; k < maxn; k++) {
      if ((n - 1) & base) {
        cur_pos = jump_to[k][cur_pos];
      }
      base <<= 1;
    }
    max_left[i] = cur_pos;
  }
  int latest_left = 0;
  for (int i = 1; i < m; i++) {
    latest_left = max(latest_left, max_left[i]);
    max_left[i] = latest_left;
  }
}
int main() {
  int n, m;
  vector<int> p;
  vector<int> a;
  cin >> n >> m;
  p.resize(n + 1);
  a.resize(m + 1);
  int q;
  cin >> q;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &p[i]);
  }
  for (int i = 1; i <= m; i++) {
    scanf("%d", &a[i]);
  }
  vector<int> pre(n + 1);
  p[0] = p[n];
  for (int i = 1; i <= n; i++) {
    pre[p[i]] = p[i - 1];
  }
  pre[0] = p[n];
  vector<vector<int> > jump_to(maxn, vector<int>(m + 1, 0));
  ConstructJumpTo(pre, a, jump_to);
  vector<int> max_left(m + 1, 0);
  FindMaxLeft(n, jump_to, max_left);
  while (q-- > 0) {
    int l, r;
    scanf("%d %d", &l, &r);
    if (max_left[r] >= l) {
      printf("1");
    } else {
      printf("0");
    }
  }
  puts("");
}
