func_code_string: #include <bits/stdc++.h>   using namespace std;   struct segment_tree {     int val[200005 << 2];     inline void update(int l, int r, int k, int x, int w) {       if (l == r) {         val[k] = w;         return;       }       int mid = l + r >> 1;       if (x <= mid)         update(l, mid, k << 1, x, w);       else         update(mid + 1, r, k << 1 | 1, x, w);       val[k] = max(val[k << 1], val[k << 1 | 1]);     }     inline int query(int l, int r, int k, int L, int R) {       if (L <= l && r <= R) return val[k];       int mid = l + r >> 1, ans = 0;       if (L <= mid) ans = max(ans, query(l, mid, k << 1, L, R));       if (mid < R) ans = max(ans, query(mid + 1, r, k << 1 | 1, L, R));       return ans;     }   } sgt;   int p[200005], pos[200005], a[200005], lg2[200005];   int lastp[200005], pre[200005][20];   char str[200005];   int main() {     int n, m, q;     scanf( %d%d%d , &n, &m, &q);     lg2[1] = 0;     for (int i = 2; i <= m; i++) lg2[i] = lg2[i >> 1] + 1;     for (int i = 1; i <= n; i++) {       scanf( %d , &p[i]);       pos[p[i]] = i;     }     p[n + 1] = p[1], p[0] = p[n];     for (int i = 1; i <= m; i++) {       scanf( %d , &a[i]);       pre[i][0] = lastp[p[pos[a[i]] - 1]];       for (int k = 1; k <= lg2[i]; k++) pre[i][k] = pre[pre[i][k - 1]][k - 1];       lastp[a[i]] = i;     }     for (int i = 1; i <= m; i++) {       int x = i, k = n - 1;       while (k) {         x = pre[x][lg2[k]];         k -= 1 << lg2[k];       }       if (x) sgt.update(1, m, 1, i, x);     }     for (int i = 1; i <= q; i++) {       int l, r;       scanf( %d%d , &l, &r);       int t = sgt.query(1, m, 1, l, r);       if (t >= l)         str[i] =  1 ;       else         str[i] =  0 ;     }     str[q + 1] =   0 ;     puts(str + 1);     return 0;   }   