//To debug :  g++ -g file.cpp -o code
//to flush output : fflush(stdout) or cout.flush()
//cout<<setprecision(p)<<fixed<<var
//use 1LL<<i to for 64 bit shifting , (ll)2 because by default 2 is ll

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,a,n) for(i=a;i<n;++i)
#define irep(i,n,a) for(i=n;i>a;--i)
#define mod 1000000007
#define pb push_back
#define big 9223372036854775807
#define big1 LONG_MAX
#define big2 ll_MAX
#define big3 1000000000
#define sma1 LONG_MIN
#define sma2 ll_MIN
#define sma3 -1000000000
#define mp make_pair
#define dub double
#define ivec vector<ll>
#define lvec vector<long long>
#define cvec vector<char>
#define svec vector<string>
#define mt make_tuple
#define MOD 998244353
#define pi acos(-1.0)/*
#define ss second.second
#define ff first.first
#define f first
#define s second
#define sf second.first
#define fs first.second*/
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)

int main()
{
    IOS;

    int n,m,k,i,j,las,pos,val,dif,v;

    cin>>n>>m>>k;

    int a[n+1],pre[n+1],ans[m+1],lc[n+1];

    for(i=1;i<=n;++i)
            cin>>a[i];

    int b[m+1];

    for(i=1;i<=m;++i)
            cin>>b[i];

    for(i=1;i<=n;++i)
    {
        j = i-1;
        if(j==0)
            j=n;
        pre[a[i]]=a[j];

        j = i-(n-1);

        if(j<=0)
            j+=n;

        lc[a[i]] = a[j];

    }

    val = 32;
    int dp[m+1][val];

    for(i=0;i<n+1;++i)
    {
        ans[i]=0;
        for(j=0;j<val;++j)
            dp[i][j]=0;
    }
    map<int,int> mm;

    for(i=1;i<=m;++i)
    {
        if(mm[pre[b[i]]]!=0)
            dp[i][0]=mm[pre[b[i]]];

        mm[b[i]]=i;

    }

    for(i=1;i<=m;++i)
    {
        for(j=1;j<val;++j)
        {
            dp[i][j] = dp[dp[i][j-1]][j-1];
        }

    }

    dif = n-1;

    for(i=1;i<=m;++i)
    {

        pos=i;

        for(j=31;j>=0;--j)
        {
            v = (1<<j);

            if(v & dif)
            {
                pos = dp[pos][j];
            }

        }

        ans[i] = pos;

    }

    int lef,rig;

    for(i=2;i<=m;++i)
    {
        ans[i] = max(ans[i-1],ans[i]);
    }

    while(k--)
    {
        cin>>lef>>rig;

        val = lc[b[rig]];

        if(ans[rig]>=lef)
        {
            cout<<1;
        }
        else
            cout<<0;

    }

    return 0;
}


//To debug :  g++ -g file.cpp -o code
//to flush output : fflush(stdout) or cout.flush()
//cout<<setprecision(p)<<fixed<<var
//use 1LL<<i to for 64 bit shifting , (ll)2 because by default 2 is ll

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,a,n) for(i=a;i<n;++i)
#define irep(i,n,a) for(i=n;i>a;--i)
#define mod 1000000007
#define pb push_back
#define big 9223372036854775807
#define big1 LONG_MAX
#define big2 ll_MAX
#define big3 1000000000
#define sma1 LONG_MIN
#define sma2 ll_MIN
#define sma3 -1000000000
#define mp make_pair
#define dub double
#define ivec vector<ll>
#define lvec vector<long long>
#define cvec vector<char>
#define svec vector<string>
#define mt make_tuple
#define MOD 998244353
#define pi acos(-1.0)/*
#define ss second.second
#define ff first.first
#define f first
#define s second
#define sf second.first
#define fs first.second*/
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)

int main()
{
    IOS;

    int n,m,k,i,j,las,pos,val,dif,v;

    cin>>n>>m>>k;

    int a[n+1],pre[n+1],ans[m+1],lc[n+1];

    for(i=1;i<=n;++i)
            cin>>a[i];

    int b[m+1];

    for(i=1;i<=m;++i)
            cin>>b[i];

    for(i=1;i<=n;++i)
    {
        j = i-1;
        if(j==0)
            j=n;
        pre[a[i]]=a[j];

        j = i-(n-1);

        if(j<=0)
            j+=n;

        lc[a[i]] = a[j];

    }

    val = log2(n)+2;
    int dp[m+1][val];

    for(i=0;i<n+1;++i)
    {
        ans[i]=0;
        for(j=0;j<val;++j)
            dp[i][j]=0;
    }
    map<int,int> mm;

    for(i=1;i<=m;++i)
    {
        if(mm[pre[b[i]]]!=0)
            dp[i][0]=mm[pre[b[i]]];

        mm[b[i]]=i;

    }

    for(i=1;i<=m;++i)
    {
        for(j=1;j<val;++j)
        {
            dp[i][j] = dp[dp[i][j-1]][j-1];
        }

    }

    dif = n-1;

    for(i=1;i<=m;++i)
    {

        pos=i;

        for(j=31;j>=0;--j)
        {
            v = (1<<j);

            if((v & dif)&& (j<val))
            {
                pos = dp[pos][j];
            }

        }

        ans[i] = pos;

    }

    int lef,rig;

    for(i=2;i<=m;++i)
    {
        ans[i] = max(ans[i-1],ans[i]);
    }

    while(k--)
    {
        cin>>lef>>rig;

        val = lc[b[rig]];

        if(ans[rig]>=lef)
        {
            cout<<1;
        }
        else
            cout<<0;

    }

    return 0;
}


//To debug :  g++ -g file.cpp -o code
//to flush output : fflush(stdout) or cout.flush()
//cout<<setprecision(p)<<fixed<<var
//use 1LL<<i to for 64 bit shifting , (ll)2 because by default 2 is ll

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,a,n) for(i=a;i<n;++i)
#define irep(i,n,a) for(i=n;i>a;--i)
#define mod 1000000007
#define pb push_back
#define big 9223372036854775807
#define big1 LONG_MAX
#define big2 ll_MAX
#define big3 1000000000
#define sma1 LONG_MIN
#define sma2 ll_MIN
#define sma3 -1000000000
#define mp make_pair
#define dub double
#define ivec vector<ll>
#define lvec vector<long long>
#define cvec vector<char>
#define svec vector<string>
#define mt make_tuple
#define MOD 998244353
#define pi acos(-1.0)/*
#define ss second.second
#define ff first.first
#define f first
#define s second
#define sf second.first
#define fs first.second*/
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)

int main()
{
    IOS;

    int n,m,k,i,j,las,pos,val,dif,v;

    cin>>n>>m>>k;

    int a[n+1],pre[n+1],ans[m+1],lc[n+1];

    for(i=1;i<=n;++i)
            cin>>a[i];

    int b[m+1];

    for(i=1;i<=m;++i)
            cin>>b[i];

    if(m<n)
    {
        while(k--)
        {
            cin>>i>>j;
            cout<<0;
        }
    }

    for(i=1;i<=n;++i)
    {
        j = i-1;
        if(j==0)
            j=n;
        pre[a[i]]=a[j];

        j = i-(n-1);

        if(j<=0)
            j+=n;

        lc[a[i]] = a[j];

    }

    val = 32;
    int dp[m+1][val];

    for(i=0;i<n+1;++i)
    {
        ans[i]=0;
        for(j=0;j<val;++j)
            dp[i][j]=0;
    }

    int mm[m+1]={0};

    for(i=1;i<=m;++i)
    {
        if(mm[pre[b[i]]]!=0)
            dp[i][0]=mm[pre[b[i]]];

        mm[b[i]]=i;

    }

    for(i=1;i<=m;++i)
    {
        for(j=1;j<val;++j)
        {
            dp[i][j] = dp[dp[i][j-1]][j-1];
        }

    }

    dif = n-1;

    for(i=1;i<=m;++i)
    {

        pos=i;

        for(j=31;j>=0;--j)
        {
            v = (1<<j);

            if(v & dif)
            {
                pos = dp[pos][j];
            }

        }

        ans[i] = pos;

    }

    int lef,rig;

    for(i=2;i<=m;++i)
    {
        ans[i] = max(ans[i-1],ans[i]);
    }

    while(k--)
    {
        cin>>lef>>rig;

        val = lc[b[rig]];

        if(ans[rig]>=lef)
        {
            cout<<1;
        }
        else
            cout<<0;

    }

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define DIM 200009
#define INF ((long long)1e18+9ll)
#define pairll pair<long long,long long>
#define fi first
#define se second
#define ld long double
#define endl '\n'
#define fast ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define amen exit(0)

long long i,j,k,l,n,m,root,b,x,y,num,q;

long long p[2*DIM],a[DIM],par[DIM][25],pos[DIM],nums[DIM],last[DIM],sz[DIM];

int main()
{
    fast;

    cin>>n>>m>>q;
    for(i=1;i<=n;i++)cin>>p[i],pos[p[i]]=i;
    p[0]=p[n];
    for(i=1;i<=m;i++)cin>>a[i];

    memset(nums,-1,sizeof(nums));
    memset(last,-1,sizeof(last));

    for(i=1;i<=m;i++){
        nums[a[i]]=i;
        if(nums[p[pos[a[i]]-1]]==-1){
            par[i][0]=i;
            sz[i]=1;
        }
        else{
            sz[i]=sz[nums[p[pos[a[i]]-1]]]+1;
            par[i][0]=nums[p[pos[a[i]]-1]];
        }
        for(j=1;j<25;j++){
            par[i][j]=par[par[i][j-1]][j-1];
        }
        if(sz[i]>=n){
            long long x=i,k=n;
            for(j=25;j>=0;j--){
                if(k>(1<<j)){
                    x=par[x][j];
                    k-=(1<<j);
                  //  cout<<i<<' '<<x<<' '<<k<<' '<<(1<<j)<<endl;
                }
            }
            if(k==1){
                x=par[x][0];
            }
            last[i]=x;
        }
    }

  //  for(i=1;i<=m;i++)last[i]=max(last[i],last[i-1]),cout<<last[i]<<' ';

//    cout<<endl;

    for(i=1;i<=q;i++){
        cin>>k>>l;
        if(last[l]>=k)cout<<1;
        else cout<<0;
    }
    cout<<endl;

    amen;
}


#include <bits/stdc++.h>

using namespace std;

#define DIM 200009
#define INF ((long long)1e18+9ll)
#define pairll pair<long long,long long>
#define fi first
#define se second
#define ld long double
#define endl '\n'
#define fast ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define amen exit(0)

long long i,j,k,l,n,m,root,b,x,y,num,q;

long long p[2*DIM],a[DIM],par[DIM][25],pos[DIM],nums[DIM],last[DIM],sz[DIM];

int main()
{
    fast;

    cin>>n>>m>>q;
    for(i=1;i<=n;i++)cin>>p[i],pos[p[i]]=i;
    p[0]=p[n];
    for(i=1;i<=m;i++)cin>>a[i];

    memset(nums,-1,sizeof(nums));
    memset(last,-1,sizeof(last));

    for(i=1;i<=m;i++){
        nums[a[i]]=i;
        if(nums[p[pos[a[i]]-1]]==-1){
            par[i][0]=i;
            sz[i]=1;
        }
        else{
            sz[i]=sz[nums[p[pos[a[i]]-1]]]+1;
            par[i][0]=nums[p[pos[a[i]]-1]];
        }
        for(j=1;j<25;j++){
            par[i][j]=par[par[i][j-1]][j-1];
        }
        if(sz[i]>=n){
            long long x=i,k=n-1;
            for(j=25;j>=0;j--){
                if(k>(1<<j)){
                    x=par[x][j];
                    k-=(1<<j);
                   // if(i>5)cout<<i<<' '<<x<<' '<<k<<' '<<(1<<j)<<endl;
                }
            }
            if(k==1){
                x=par[x][0];
            }
            last[i]=x;
        }
    }

    for(i=1;i<=m;i++)last[i]=max(last[i],last[i-1]);

    for(i=1;i<=q;i++){
        cin>>k>>l;
        if(last[l]>=k)cout<<1;
        else cout<<0;
    }
    cout<<endl;

    amen;
}


#include <bits/stdc++.h>

using namespace std;

#define DIM 200009
#define INF ((long long)1e18+9ll)
#define pairll pair<long long,long long>
#define fi first
#define se second
#define ld long double
#define endl '\n'
#define fast ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define amen exit(0)

long long i,j,k,l,n,m,root,b,x,y,num,q;

long long p[2*DIM],a[DIM],par[DIM][25],pos[DIM],nums[DIM],last[DIM],sz[DIM];

int main()
{
    fast;

    cin>>n>>m>>q;
    for(i=1;i<=n;i++)cin>>p[i],pos[p[i]]=i;
    p[0]=p[n];
    for(i=1;i<=m;i++)cin>>a[i];

    memset(nums,-1,sizeof(nums));
    memset(last,-1,sizeof(last));

    for(i=1;i<=m;i++){
        nums[a[i]]=i;
        if(nums[p[pos[a[i]]-1]]==-1){
            par[i][0]=i;
            sz[i]=1;
        }
        else{
            sz[i]=sz[nums[p[pos[a[i]]-1]]]+1;
            par[i][0]=nums[p[pos[a[i]]-1]];
        }
        for(j=1;j<25;j++){
            par[i][j]=par[par[i][j-1]][j-1];
        }
        if(sz[i]>=n){
            long long x=i,k=n;
            for(j=25;j>=0;j--){
                if(k>j){
                    x=par[x][j];
                    k-=(1<<j);
                  //  cout<<i<<' '<<x<<' '<<k<<' '<<(1<<j)<<endl;
                }
            }
            if(k==1){
                x=par[x][0];
            }
            last[i]=x;
        }
    }

  //  for(i=1;i<=m;i++)last[i]=max(last[i],last[i-1]),cout<<last[i]<<' ';

//    cout<<endl;

    for(i=1;i<=q;i++){
        cin>>k>>l;
        if(last[l]>=k)cout<<1;
        else cout<<0;
    }
    cout<<endl;

    amen;
}


/*
  In the name of ALLAH
  Author : Raashid Anwar
*/

#include <bits/stdc++.h>
using namespace std;

#define int int64_t
const int M1 =  998244353;
const int M2 =  1000000007;
mt19937 rng((uint64_t)chrono::steady_clock::now().time_since_epoch().count());

void solve() {
  int n, m, q;
  cin >> n >> m >> q;
  vector <int> a(n + 1, 0), p(n + 1, 0), b(n + 1, 0), ans(m + 1, 0);
  int dp[m + 1][20];
  memset(dp, 0, sizeof(dp));
  for(int i = 1; i <= n; i++) {
    cin >> a[i];
    p[a[i]] = a[i - 1];
  }
  p[a[1]] = a[n];
  for(int i = 1; i <= m; i++) {
    int x;
    cin >> x;
    dp[i][0] = b[p[x]];
    for(int j = 1; j < 20; j++)
      dp[i][j] = dp[dp[i][j - 1]][j - 1];
    b[x] = i;
  }
  for(int i = 1; i <= m; i++) {
    int x = n - 1;
    int u = i;
    for(int j = 19; j >= 0; j--) {
      if(x - (int(1) << j) >= 0) {
        u = dp[u][j];
        x -= (int(1) << j);
      }
    }
    ans[i] = max(ans[i - 1], u);
  }
  while(q--) {
    int l, r;
    cin >> l >> r;
    cout << (ans[r] >= l? 1: 0);
  }
  cout << "\n";
}

int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  solve();
}


/*
  In the name of ALLAH
  Author : Raashid Anwar
*/

#include <bits/stdc++.h>
using namespace std;

#define int int64_t
const int M1 =  998244353;
const int M2 =  1000000007;
mt19937 rng((uint64_t)chrono::steady_clock::now().time_since_epoch().count());

void solve() {
  int n, m, q;
  cin >> n >> m >> q;
  vector <int> a(n + 1, 0), p(n + 1, 0), b(n + 1, 0), ans(m + 1, 0);
  int dp[m + 1][20];
  memset(dp, 0, sizeof(dp));
  for(int i = 1; i <= n; i++) {
    cin >> a[i];
    p[a[i]] = a[i - 1];
  }
  p[a[1]] = a[n];
  for(int i = 1; i <= m; i++) {
    int x;
    cin >> x;
    dp[i][0] = b[p[x]];
    for(int j = 1; j < 20; j++)
      dp[i][j] = dp[dp[i][j - 1]][j - 1];
    b[x] = i;
  }
  for(int i = 1; i <= m; i++) {
    int x = n - 1;
    int u = i;
    for(int j = 19; j >= 0; j--) {
      if(x - (1 << j) >= 0) {
        u = dp[u][j];
        x -= (1 << j);
      }
    }
    ans[i] = max(ans[i], u);
  }
  while(q--) {
    int l, r;
    cin >> l >> r;
    cout << (ans[r] >= l? 1: 0);
  }
  cout << "\n";
}

int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  solve();
}


#include <bits/stdc++.h>
using namespace std;

#define VIC ios::sync_with_stdio(0);cin.tie(0);ios_base::sync_with_stdio(0);
#define wtf(s) freopen((s), "w", stdout)
#define rff(s) freopen((s), "r", stdin)
#define pi (2 * acos(0))
typedef long double ld;
typedef long long ll;
#define endl '\n';
#define matrix vector<vector<ll>>

const int N = 2e5 + 10;
const ll mod = 1000000007;
int n, m, q, p[200005], next_in_perm[200005], go_next[200005], go_pre[200005], pre_in_perm[200005], val[N];
vector< vector< int > > pos(200005);
bool vis[N], found[N], fun;
queue<int> qu;
int sparse[N][20] , lg[N];
vector< int > v;
void sp_cal()
{
    for(int j=0;j<=lg[m];j++)
        for(int i=0;i+ (1<<j) -1<m;i++)
            if(j==0)
                sparse[i][j]=val[i];
            else
                sparse[i][j]=min(sparse[i][j-1],sparse[i+(1<<(j-1))][j-1]);
}
int solve( int l , int r)
{
    int len=lg[r-l+1];
    return  min(sparse[l][len],sparse[r-(1<<len) +1 ][len]);
}
void dfs(int cur)
{
    vis[cur] = true;
    if (go_next[cur] != -1)
    {
        if (!vis[go_next[cur]])
            dfs(go_next[cur]);
        else
            fun = true;
    }
    if (fun)
    {
        found[cur] = true;
        return;
    }
    qu.push(cur);
    if (qu.size() == n)
    {
        val[cur] = qu.front();
        qu.pop();
    }
}

int main()
{
    VIC
    lg[1]=0;
    for(int i=2;i<=2e5+5;i++)
        lg[i]=lg[i/2]+1;
    memset(go_next, -1, sizeof go_next);
    cin >> n >> m>> q;
    v.resize(m);
    for(int i = 0; i < n; i ++)
        cin >> p[i];
    for(int i = 0; i < m; i ++)
        cin >> v[i] ,  val[i]=1e9,
        pos[v[i]].push_back(i);

    next_in_perm[p[n - 1]] = p[0];
    for(int i = 0; i < n - 1; i ++)
        next_in_perm[p[i]] = p[i + 1];

    pre_in_perm[p[0]] = p[n - 1];
    for(int i = n - 1; i > 0; i --)
        pre_in_perm[p[i]] = p[i - 1];

    for(int i = 0; i < m; i ++)
    {
        int idx = lower_bound(pos[next_in_perm[v[i]]].begin(), pos[next_in_perm[v[i]]].end(), i) - pos[next_in_perm[v[i]]].begin();
        if(idx < pos[next_in_perm[v[i]]].size())
            go_next[i] = pos[next_in_perm[v[i]]][idx];
        idx = lower_bound(pos[v[i]].begin(), pos[v[i]].end(), i) - pos[v[i]].begin();
        if(idx - 1 >= 0)
            go_pre[i] = pos[v[i]][idx-1];
        else go_pre[i] = i;

    }

    for (int i = 0; i < m; i++)
    {
        while (!qu.empty())
            qu.pop();
        fun = false;
        if (!vis[i])
          dfs(i);
    }
    for (int i = 0; i < m; i++)
    {
        if (found[i])
            val[i] = val[go_pre[i]];
        if (n == 1)
            val[i] = i;
    }
    sp_cal();
    while (q--){
        int l , r ;
        cin>>l>>r;
        l-- , r--;
        cout<<(solve(l,r) <= r ? 1 : 0);
    }

    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define VIC ios::sync_with_stdio(0);cin.tie(0);ios_base::sync_with_stdio(0);
#define wtf(s) freopen((s), "w", stdout)
#define rff(s) freopen((s), "r", stdin)
#define pi (2 * acos(0))
typedef long double ld;
typedef long long ll;
#define endl '\n';
#define matrix vector<vector<ll>>

const int N = 2e5 + 10;
const ll mod = 1000000007;
int n, m, q, p[200005], a[200009] ,val[200009] , sparse[200009][20] , lg[200009] , pos[200009] , vis[200009];
vector<int> id[200009];
vector<int> v[200009];
void sp_cal()
{
    for(int j=0;j<=lg[m];j++)
        for(int i=0;i+ (1<<j) -1<m;i++)
            if(j==0)
                sparse[i][j]=val[i];
            else
                sparse[i][j]=min(sparse[i][j-1],sparse[i+(1<<(j-1))][j-1]);
}
int solve( int l , int r)
{
    int len=lg[r-l+1];
    return  min(sparse[l][len],sparse[r-(1<<len) +1 ][len]);
}
vector<int> nodes;
void dfs(int node)
{
    vis[node]++;
    nodes.push_back(node);
    if(nodes.size()>=n)
    {
        int z=nodes.size();
        val[nodes.back()]=nodes[z-n];
    }
    for(auto i : v[node])
        if(!vis[i])
            dfs(i);
    nodes.pop_back();
}
int main()
{
    VIC
    lg[1]=0;
    for(int i=2;i<=2e5+5;i++)
        lg[i]=lg[i/2]+1;
    cin >> n >> m>> q;
    for(int i = 0; i < n; i ++)
    {
        cin >> p[i];
        pos[p[i]]=i;
    }
    for(int i=0;i<m;i++)
        cin>>a[i] , id[a[i]].push_back(i);
    for(int i=0;i<m;i++)
    {
        val[i]=1e9;
        int my_next=p[(pos[a[i]]+1)%n];
        int ind=upper_bound(id[my_next].begin(), id[my_next].end(),i)-id[my_next].begin();
        if(ind<id[my_next].size())
        {
            int par=id[my_next][ind];
            v[par].push_back(i);
        }
    }
    memset(vis , 0 , sizeof vis);
    for(int i=m-1;i>=0;i--)
        if(!vis[i])
            dfs(i);

    sp_cal();
    while (q--){
        int l , r ;
        cin>>l>>r;
        l-- , r--;
        cout<<(solve(l,r) <= r ? 1 : 0);
    }

    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define VIC ios::sync_with_stdio(0);cin.tie(0);ios_base::sync_with_stdio(0);
#define wtf(s) freopen((s), "w", stdout)
#define rff(s) freopen((s), "r", stdin)
#define pi (2 * acos(0))
typedef long double ld;
typedef long long ll;
#define endl '\n';
#define matrix vector<vector<ll>>

const int N = 2e5 + 10;
const ll mod = 1000000007;
int n, m, q, p[200005], next_in_perm[200005], go_next[200005], go_pre[200005], pre_in_perm[200005], val[N];
vector< vector< int > > pos(200005);
bool vis[N], found[N], fun;
queue<int> qu;
int sparse[N][20] , lg[N];
vector< int > v;
void sp_cal()
{
    for(int j=0;j<=lg[m];j++)
        for(int i=0;i+ (1<<j) -1<m;i++)
            if(j==0)
                sparse[i][j]=val[i];
            else
                sparse[i][j]=min(sparse[i][j-1],sparse[i+(1<<(j-1))][j-1]);
}
int solve( int l , int r)
{
    int len=lg[r-l+1];
    return  min(sparse[l][len],sparse[r-(1<<len) +1 ][len]);
}
void dfs(int cur)
{
    vis[cur] = true;
    if (go_next[cur] != -1)
    {
        if (!vis[go_next[cur]])
            dfs(go_next[cur]);
        else
            fun = true;
    }
    if (fun)
    {
        found[cur] = true;
        return;
    }
    qu.push(cur);
    if (qu.size() == n)
    {
        val[cur] = qu.front();
        qu.pop();
    }
}

int main()
{
    VIC
    lg[1]=0;
    for(int i=2;i<=2e5+5;i++)
        lg[i]=lg[i/2]+1;
    memset(go_next, -1, sizeof go_next);
    cin >> n >> m>> q;
    v.resize(m);
    for(int i = 0; i < n; i ++)
        cin >> p[i];
    for(int i = 0; i < m; i ++)
        cin >> v[i] ,  val[i]=1e9,
        pos[v[i]].push_back(i);

    next_in_perm[p[n - 1]] = p[0];
    for(int i = 0; i < n - 1; i ++)
        next_in_perm[p[i]] = p[i + 1];

    pre_in_perm[p[0]] = p[n - 1];
    for(int i = n - 1; i > 0; i --)
        pre_in_perm[p[i]] = p[i - 1];

    for(int i = 0; i < m; i ++)
    {
        int idx = lower_bound(pos[next_in_perm[v[i]]].begin(), pos[next_in_perm[v[i]]].end(), i) - pos[next_in_perm[v[i]]].begin();
        if(idx < pos[next_in_perm[v[i]]].size())
            go_next[i] = pos[next_in_perm[v[i]]][idx];
        idx = lower_bound(pos[v[i]].begin(), pos[v[i]].end(), i) - pos[v[i]].begin();
        if(idx - 1 >= 0)
            go_pre[i] = pos[v[i]][idx-1];
        else go_pre[i] = i;

    }

    for (int i = 0; i < m; i++)
    {
        while (!qu.empty())
            qu.pop();
        fun = false;
        if (!vis[i])
          dfs(i);
    }
    for (int i = 0; i < m; i++)
    {
        if (found[i])
            val[i] = val[go_pre[i]];
       // cout<<val[i]<<endl;
    }
    sp_cal();
    while (q--){
        int l , r ;
        cin>>l>>r;
        l-- , r--;
        cout<<(solve(l,r) <= r ? 1 : 0);
    }

    return 0;
}


#pragma GCC optimize("O3")
#ifdef ONLINE_JUDGE
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#endif
#pragma GCC optimize("unroll-loops")
#pragma comment(linker, "/stack:200000000")
#include <bits/stdc++.h>
#include <deque>
#include <type_traits>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
template<typename KeyType=int,typename Mapped=__gnu_pbds::null_type,typename Cmp_Fn=std::less<KeyType>,typename Tag=__gnu_pbds::rb_tree_tag,template<typename Const_Node_Iterator,typename Node_Iterator,typename Cmp_Fn_,typename Allocator_>class Node_Update=__gnu_pbds::tree_order_statistics_node_update,typename Allocator=std::allocator<char>>using ordered_set_t=__gnu_pbds::tree<KeyType,Mapped,Cmp_Fn,Tag,Node_Update,Allocator>;const int GRANDOM=std::chrono::high_resolution_clock::now().time_since_epoch().count();struct ghash{int operator()(int x){return std::hash<int>{}(x^GRANDOM);}};template<typename KeyType>using hash_table_t=__gnu_pbds::gp_hash_table<KeyType,int,ghash>;namespace ____{template<class T>struct like_array:is_array<T>{};template<class T,size_t N>struct like_array<array<T,N>>:true_type{};template<class T>struct like_array<vector<T>>:true_type{};template<class T>bool is_like_array(const T&a){return like_array<T>::value;}template<class T>void _R(T&x){std::cin>>x;}inline void _R(int&x){scanf("%d",&x);}inline void _R(int64_t&x){scanf("%" SCNd64,&x);}inline void _R(double&x){scanf("%lf",&x);}inline void _R(char&x){scanf(" %c",&x);}inline void _R(char*x){scanf("%s",x);}inline void R(){}template<class T,class... U>inline void R(T&head,U&... tail){_R(head);R(tail...);}template<class T>void _W(const T&x){cout<<x;}inline void _W(const int&x){printf("%d",x);}inline void _W(const int64_t&x){printf("%" PRId64,x);}inline void _W(const double&x){printf("%.16f",x);}inline void _W(const char&x){putchar(x);}inline void _W(const char*x){printf("%s",x);}template<class T>inline void _W(const vector<T>&x){for(auto i=x.begin();i!=x.end();_W(*i++))if(i!=x.cbegin())putchar(' ');}inline void W(){}template<class T,class... U>inline void W(const T&head,const U&... tail){_W(head);if(sizeof...(tail))putchar(' '),W(tail...);}template<class T,class... U>inline void WL(const T&head,const U&... tail){_W(head);putchar(sizeof...(tail)? ' ':'\n');W(tail...);}template<class T>void _RE(T&x){cin>>x;}template<class Arg,class... Args>void _RE(Arg&first,Args&... rest);void _RE(double&x){string t;_RE(t);x=stod(t);}void _RE(long double&x){string t;_RE(t);x=stold(t);}template<class T>void _RE(complex<T>&x);template<class T1,class T2>void _RE(pair<T1,T2>&p);template<class T>void _RE(vector<T>&a);template<class T,size_t SZ>void _RE(array<T,SZ>&a);template<class Arg,class... Args>void _RE(Arg&first,Args&... rest){_RE(first);_RE(rest...);}template<class T>void _RE(complex<T>&x){T a,b;_RE(a,b);x=cd(a,b);}template<class T1,class T2>void _RE(pair<T1,T2>&p){_RE(p.f,p.s);}template<class T>void _RE(vector<T>&a){for(int i=0,ie=sz(a);i<ie;i++)_RE(a[i]);}template<class T,size_t SZ>void _RE(array<T,SZ>&a){for(int i=0;i<SZ;i++)_RE(a[i]);}};
#define prec setprecision
namespace ____{typedef long long ll;typedef unsigned long long llu;template<typename T>T gcd(T m,T n){while(n){T t=m%n;m=n;n=t;};return m;}template<typename T>T exgcd(T a,T b,T&sa,T&ta){T q,r,sb=0,tb=1,sc,tc;sa=1,ta=0;if(b)do q=a/b,r=a-q*b,a=b,b=r,sc=sa-q*sb,sa=sb,sb=sc,tc=ta-q*tb,ta=tb,tb=tc;while(b);return a;}template<typename T>T mul_inv(T a,T b){T t1=a,t2=b,t3;T v1=1,v2=0,v3;T x;while(t2!=1)x=t1/t2,t3=t1-x*t2,v3=v1-x*v2,t1=t2,t2=t3,v1=v2,v2=v3;return(v2+b)%b;}template<typename T>T powmod(T a,T b,T MOD){if(b<0)return 0;T rv=1;while(b)(b%2)&&(rv=(rv*a)%MOD),a=a*a%MOD,b/=2;return rv;}template<typename T>inline T isqrt(T k){T r=sqrt((double)k)+1;while(r*r>k)r--;return r;}template<typename T>inline T icbrt(T k){T r=cbrt((double)k)+1;while(r*r*r>k)r--;return r;}template<typename T>bool mul_overflow(T&r,T a,T b){return __builtin_mul_overflow(a,b,&r);}template<ll n>struct BitSize{enum{Size=BitSize<n/2>::Size+1};};template<>struct BitSize<0>{enum{Size=1};};template<>struct BitSize<1>{enum{Size=1};};
#define BITSIZE(n) (BitSize<n>::Size)
#define TREESIZE(n) ((1<<(BitSize<n>::Size + 1))+7)
#define BITMAX(n) (BitSize<n>::Size - 1)
#define DEBUG !defined(ONLINE_JUDGE)
#define SZ(x) ((int)(x).size())
#define ALL(x) begin(x), end(x)
#define RALL(x) (x).rbegin(),(x).rend()
template<typename TH>void _dbg(const char*sdbg,TH h){cerr<<sdbg<<"="<<h<<"\n";}template<typename TH,typename... TA>void _dbg(const char*sdbg,TH h,TA... t){while(*sdbg!=',')cerr<<*sdbg++;cerr<<"="<<h<<",";_dbg(sdbg+1,t...);}
#ifdef DEBUG
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#define debugv(x) {{cerr <<#x <<" = "; for(auto itt: x) cerr <<*itt <<", "; cerr <<"\n"; }}
#else
#define debug(...) (__VA_ARGS__)
#define debugv(x)
#define cerr if(0)cout
#endif
}namespace ____{template<typename T>int min_rotation(vector<T>s){int a=0,N=s.size();for(int b=0;b<N;b++)for(int i=0;i<N;i++){if(a+i==b||s[(a+i)%N]<s[(b+i)%N]){b+=max(0,i-1);break;}if(s[(a+i)%N]>s[(b+i)%N]){a=b;break;}}return a;};template<typename T>class StackGuard{private:T x;public:StackGuard(T x):x(x){}~StackGuard(){x();}};}namespace ____{};
namespace ____{
  const int maxn=2e5+7;
  const int maxblocks=300;
  int n,m,q;
  int p[maxn],pr[maxn];
  int a[maxn];
  char res[maxn];
  int cn[maxblocks][maxn];
  int mi[maxn];
  int main(){
    srand(GRANDOM);
    cn[0][0]=maxn;
    cin>>n>>m>>q;
    for(int i=1;i<=n;i++){cin>>p[i];pr[p[i]]=i;}
    for(int i=0;i<m;i++){
      cin>>a[i];a[i]=pr[a[i]];
    }
    int bs=max(1,n/maxblocks+7);
    memset(cn,0,sizeof(cn));
    for(int i=0;i<m;i+=bs){
      int ii=i/bs;
      for(int j=1;j<=n;j++)mi[j]=n+1,cn[ii][j]=j;
      for(int j=i,je=min(m,i+bs);j<je;j++){
        int x=a[j];
        mi[x]=min(mi[x],x);
        if(x>1)mi[x]=min(mi[x],mi[x-1]);
      }
      int last=-1,lastv=-1;
      for(int j=1;j<=n;j++){
        if(mi[j]<=j){
          if(last>0){
            for(int k=last;k<mi[j];k++){
              cn[ii][k]=lastv+1;
            }
          }else{
            for(int k=1;k<mi[j];k++)cn[ii][k]=k;
          }
          last=mi[j];
          lastv=j;
        }
      }
      if(last>0){
        for(int k=last;k<=lastv;k++){
          cn[ii][k]=lastv+1;
        }
      }
    }
    res[q]=0;
    for(int i=0;i<q;i++){
      int l,r;cin>>l>>r;l--;r--;
      int nxt=1;
      int sl=l;
      for(int z=0;z<2&&nxt<=n;z++){
        l=sl;
        while(l<=r&&(l%bs)&&nxt<=n){
          if(a[l]==nxt)nxt++;
          l++;
        }
        while(l+bs-1<=r&&nxt<=n){
          nxt=cn[l/bs][nxt];
          l+=bs;
        }
        while(l<=r&&nxt<=n){
          if(a[l]==nxt)nxt++;
          l++;
        }
      }
      res[i]=(nxt==n+1)?'1':'0';
    }
    cout<<res<<endl;
    return 0;
  }
};
int main(int argc,char*argv[]){
  std::cin.sync_with_stdio(false);std::cin.tie(nullptr);
  return ____::main();
}


#pragma GCC optimize("O3")
#ifdef ONLINE_JUDGE
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#endif
#pragma GCC optimize("unroll-loops")
#pragma comment(linker, "/stack:200000000")
#include <bits/stdc++.h>
#include <deque>
#include <type_traits>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
template<typename KeyType=int,typename Mapped=__gnu_pbds::null_type,typename Cmp_Fn=std::less<KeyType>,typename Tag=__gnu_pbds::rb_tree_tag,template<typename Const_Node_Iterator,typename Node_Iterator,typename Cmp_Fn_,typename Allocator_>class Node_Update=__gnu_pbds::tree_order_statistics_node_update,typename Allocator=std::allocator<char>>using ordered_set_t=__gnu_pbds::tree<KeyType,Mapped,Cmp_Fn,Tag,Node_Update,Allocator>;const int GRANDOM=std::chrono::high_resolution_clock::now().time_since_epoch().count();struct ghash{int operator()(int x){return std::hash<int>{}(x^GRANDOM);}};template<typename KeyType>using hash_table_t=__gnu_pbds::gp_hash_table<KeyType,int,ghash>;namespace ____{template<class T>struct like_array:is_array<T>{};template<class T,size_t N>struct like_array<array<T,N>>:true_type{};template<class T>struct like_array<vector<T>>:true_type{};template<class T>bool is_like_array(const T&a){return like_array<T>::value;}template<class T>void _R(T&x){std::cin>>x;}inline void _R(int&x){scanf("%d",&x);}inline void _R(int64_t&x){scanf("%" SCNd64,&x);}inline void _R(double&x){scanf("%lf",&x);}inline void _R(char&x){scanf(" %c",&x);}inline void _R(char*x){scanf("%s",x);}inline void R(){}template<class T,class... U>inline void R(T&head,U&... tail){_R(head);R(tail...);}template<class T>void _W(const T&x){cout<<x;}inline void _W(const int&x){printf("%d",x);}inline void _W(const int64_t&x){printf("%" PRId64,x);}inline void _W(const double&x){printf("%.16f",x);}inline void _W(const char&x){putchar(x);}inline void _W(const char*x){printf("%s",x);}template<class T>inline void _W(const vector<T>&x){for(auto i=x.begin();i!=x.end();_W(*i++))if(i!=x.cbegin())putchar(' ');}inline void W(){}template<class T,class... U>inline void W(const T&head,const U&... tail){_W(head);if(sizeof...(tail))putchar(' '),W(tail...);}template<class T,class... U>inline void WL(const T&head,const U&... tail){_W(head);putchar(sizeof...(tail)? ' ':'\n');W(tail...);}template<class T>void _RE(T&x){cin>>x;}template<class Arg,class... Args>void _RE(Arg&first,Args&... rest);void _RE(double&x){string t;_RE(t);x=stod(t);}void _RE(long double&x){string t;_RE(t);x=stold(t);}template<class T>void _RE(complex<T>&x);template<class T1,class T2>void _RE(pair<T1,T2>&p);template<class T>void _RE(vector<T>&a);template<class T,size_t SZ>void _RE(array<T,SZ>&a);template<class Arg,class... Args>void _RE(Arg&first,Args&... rest){_RE(first);_RE(rest...);}template<class T>void _RE(complex<T>&x){T a,b;_RE(a,b);x=cd(a,b);}template<class T1,class T2>void _RE(pair<T1,T2>&p){_RE(p.f,p.s);}template<class T>void _RE(vector<T>&a){for(int i=0,ie=sz(a);i<ie;i++)_RE(a[i]);}template<class T,size_t SZ>void _RE(array<T,SZ>&a){for(int i=0;i<SZ;i++)_RE(a[i]);}};
#define prec setprecision
namespace ____{typedef long long ll;typedef unsigned long long llu;template<typename T>T gcd(T m,T n){while(n){T t=m%n;m=n;n=t;};return m;}template<typename T>T exgcd(T a,T b,T&sa,T&ta){T q,r,sb=0,tb=1,sc,tc;sa=1,ta=0;if(b)do q=a/b,r=a-q*b,a=b,b=r,sc=sa-q*sb,sa=sb,sb=sc,tc=ta-q*tb,ta=tb,tb=tc;while(b);return a;}template<typename T>T mul_inv(T a,T b){T t1=a,t2=b,t3;T v1=1,v2=0,v3;T x;while(t2!=1)x=t1/t2,t3=t1-x*t2,v3=v1-x*v2,t1=t2,t2=t3,v1=v2,v2=v3;return(v2+b)%b;}template<typename T>T powmod(T a,T b,T MOD){if(b<0)return 0;T rv=1;while(b)(b%2)&&(rv=(rv*a)%MOD),a=a*a%MOD,b/=2;return rv;}template<typename T>inline T isqrt(T k){T r=sqrt((double)k)+1;while(r*r>k)r--;return r;}template<typename T>inline T icbrt(T k){T r=cbrt((double)k)+1;while(r*r*r>k)r--;return r;}template<typename T>bool mul_overflow(T&r,T a,T b){return __builtin_mul_overflow(a,b,&r);}template<ll n>struct BitSize{enum{Size=BitSize<n/2>::Size+1};};template<>struct BitSize<0>{enum{Size=1};};template<>struct BitSize<1>{enum{Size=1};};
#define BITSIZE(n) (BitSize<n>::Size)
#define TREESIZE(n) ((1<<(BitSize<n>::Size + 1))+7)
#define BITMAX(n) (BitSize<n>::Size - 1)
#define DEBUG !defined(ONLINE_JUDGE)
#define SZ(x) ((int)(x).size())
#define ALL(x) begin(x), end(x)
#define RALL(x) (x).rbegin(),(x).rend()
template<typename TH>void _dbg(const char*sdbg,TH h){cerr<<sdbg<<"="<<h<<"\n";}template<typename TH,typename... TA>void _dbg(const char*sdbg,TH h,TA... t){while(*sdbg!=',')cerr<<*sdbg++;cerr<<"="<<h<<",";_dbg(sdbg+1,t...);}
#ifdef DEBUG
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#define debugv(x) {{cerr <<#x <<" = "; for(auto itt: x) cerr <<*itt <<", "; cerr <<"\n"; }}
#else
#define debug(...) (__VA_ARGS__)
#define debugv(x)
#define cerr if(0)cout
#endif
}namespace ____{template<typename T>int min_rotation(vector<T>s){int a=0,N=s.size();for(int b=0;b<N;b++)for(int i=0;i<N;i++){if(a+i==b||s[(a+i)%N]<s[(b+i)%N]){b+=max(0,i-1);break;}if(s[(a+i)%N]>s[(b+i)%N]){a=b;break;}}return a;};template<typename T>class StackGuard{private:T x;public:StackGuard(T x):x(x){}~StackGuard(){x();}};}namespace ____{};
namespace ____{
  const int maxn=2e5+7;
  const int maxblocks=300;
  int n,m,q;
  int p[maxn],pr[maxn];
  int a[maxn];
  char res[maxn];
  int cn[maxblocks][maxn];
  int mi[maxn];
  int main(){
    srand(GRANDOM);
    cn[0][0]=maxn;
    cin>>n>>m>>q;
    for(int i=1;i<=n;i++){cin>>p[i];pr[p[i]]=i;}
    for(int i=0;i<m;i++){
      cin>>a[i];a[i]=pr[a[i]];
    }
    int bs=max(1,n/maxblocks+1);
    memset(cn,0,sizeof(cn));
    for(int i=0;i<m;i+=bs){
      int ii=i/bs;
      for(int j=1;j<=n;j++)mi[j]=n+1,cn[ii][j]=j;
      for(int j=i,je=min(m,i+bs);j<je;j++){
        int x=a[j];
        mi[x]=min(mi[x],x);
        if(x>1)mi[x]=min(mi[x],mi[x-1]);
      }
      int last=-1,lastv=-1;
      for(int j=1;j<=n;j++){
        if(mi[j]<=j){
          if(last>0){
            for(int k=last;k<mi[j];k++){
              cn[ii][k]=lastv+1;
            }
          }else{
            for(int k=1;k<mi[j];k++)cn[ii][k]=k;
          }
          last=mi[j];
          lastv=j;
        }
      }
      if(last>0){
        for(int k=last;k<=lastv;k++){
          cn[ii][k]=lastv+1;
        }
      }
    }
    res[q]=0;
    for(int i=0;i<q;i++){
      int l,r;cin>>l>>r;l--;r--;
      int nxt=1;
      int sl=l;
      for(int z=0;z<2&&nxt<=n;z++){
        l=sl;
        while(l<=r&&(l%bs)&&nxt<=n){
          if(a[l]==nxt)nxt++;
          l++;
        }
        while(l+bs-1<=r&&nxt<=n){
          nxt=cn[l/bs][nxt];
          l+=bs;
        }
        while(l<=r&&nxt<=n){
          if(a[l]==nxt)nxt++;
          l++;
        }
      }
      res[i]=(nxt==n+1)?'1':'0';
    }
    cout<<res<<endl;
    return 0;
  }
};
int main(int argc,char*argv[]){
  std::cin.sync_with_stdio(false);std::cin.tie(nullptr);
  return ____::main();
}


#pragma GCC optimize("O3")
#ifdef ONLINE_JUDGE
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#endif
#pragma GCC optimize("unroll-loops")
#pragma comment(linker, "/stack:200000000")
#include <bits/stdc++.h>
#include <deque>
#include <type_traits>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
template<typename KeyType=int,typename Mapped=__gnu_pbds::null_type,typename Cmp_Fn=std::less<KeyType>,typename Tag=__gnu_pbds::rb_tree_tag,template<typename Const_Node_Iterator,typename Node_Iterator,typename Cmp_Fn_,typename Allocator_>class Node_Update=__gnu_pbds::tree_order_statistics_node_update,typename Allocator=std::allocator<char>>using ordered_set_t=__gnu_pbds::tree<KeyType,Mapped,Cmp_Fn,Tag,Node_Update,Allocator>;const int GRANDOM=std::chrono::high_resolution_clock::now().time_since_epoch().count();struct ghash{int operator()(int x){return std::hash<int>{}(x^GRANDOM);}};template<typename KeyType>using hash_table_t=__gnu_pbds::gp_hash_table<KeyType,int,ghash>;namespace ____{template<class T>struct like_array:is_array<T>{};template<class T,size_t N>struct like_array<array<T,N>>:true_type{};template<class T>struct like_array<vector<T>>:true_type{};template<class T>bool is_like_array(const T&a){return like_array<T>::value;}template<class T>void _R(T&x){std::cin>>x;}inline void _R(int&x){scanf("%d",&x);}inline void _R(int64_t&x){scanf("%" SCNd64,&x);}inline void _R(double&x){scanf("%lf",&x);}inline void _R(char&x){scanf(" %c",&x);}inline void _R(char*x){scanf("%s",x);}inline void R(){}template<class T,class... U>inline void R(T&head,U&... tail){_R(head);R(tail...);}template<class T>void _W(const T&x){cout<<x;}inline void _W(const int&x){printf("%d",x);}inline void _W(const int64_t&x){printf("%" PRId64,x);}inline void _W(const double&x){printf("%.16f",x);}inline void _W(const char&x){putchar(x);}inline void _W(const char*x){printf("%s",x);}template<class T>inline void _W(const vector<T>&x){for(auto i=x.begin();i!=x.end();_W(*i++))if(i!=x.cbegin())putchar(' ');}inline void W(){}template<class T,class... U>inline void W(const T&head,const U&... tail){_W(head);if(sizeof...(tail))putchar(' '),W(tail...);}template<class T,class... U>inline void WL(const T&head,const U&... tail){_W(head);putchar(sizeof...(tail)? ' ':'\n');W(tail...);}template<class T>void _RE(T&x){cin>>x;}template<class Arg,class... Args>void _RE(Arg&first,Args&... rest);void _RE(double&x){string t;_RE(t);x=stod(t);}void _RE(long double&x){string t;_RE(t);x=stold(t);}template<class T>void _RE(complex<T>&x);template<class T1,class T2>void _RE(pair<T1,T2>&p);template<class T>void _RE(vector<T>&a);template<class T,size_t SZ>void _RE(array<T,SZ>&a);template<class Arg,class... Args>void _RE(Arg&first,Args&... rest){_RE(first);_RE(rest...);}template<class T>void _RE(complex<T>&x){T a,b;_RE(a,b);x=cd(a,b);}template<class T1,class T2>void _RE(pair<T1,T2>&p){_RE(p.f,p.s);}template<class T>void _RE(vector<T>&a){for(int i=0,ie=sz(a);i<ie;i++)_RE(a[i]);}template<class T,size_t SZ>void _RE(array<T,SZ>&a){for(int i=0;i<SZ;i++)_RE(a[i]);}};
#define prec setprecision
namespace ____{typedef long long ll;typedef unsigned long long llu;template<typename T>T gcd(T m,T n){while(n){T t=m%n;m=n;n=t;};return m;}template<typename T>T exgcd(T a,T b,T&sa,T&ta){T q,r,sb=0,tb=1,sc,tc;sa=1,ta=0;if(b)do q=a/b,r=a-q*b,a=b,b=r,sc=sa-q*sb,sa=sb,sb=sc,tc=ta-q*tb,ta=tb,tb=tc;while(b);return a;}template<typename T>T mul_inv(T a,T b){T t1=a,t2=b,t3;T v1=1,v2=0,v3;T x;while(t2!=1)x=t1/t2,t3=t1-x*t2,v3=v1-x*v2,t1=t2,t2=t3,v1=v2,v2=v3;return(v2+b)%b;}template<typename T>T powmod(T a,T b,T MOD){if(b<0)return 0;T rv=1;while(b)(b%2)&&(rv=(rv*a)%MOD),a=a*a%MOD,b/=2;return rv;}template<typename T>inline T isqrt(T k){T r=sqrt((double)k)+1;while(r*r>k)r--;return r;}template<typename T>inline T icbrt(T k){T r=cbrt((double)k)+1;while(r*r*r>k)r--;return r;}template<typename T>bool mul_overflow(T&r,T a,T b){return __builtin_mul_overflow(a,b,&r);}template<ll n>struct BitSize{enum{Size=BitSize<n/2>::Size+1};};template<>struct BitSize<0>{enum{Size=1};};template<>struct BitSize<1>{enum{Size=1};};
#define BITSIZE(n) (BitSize<n>::Size)
#define TREESIZE(n) ((1<<(BitSize<n>::Size + 1))+7)
#define BITMAX(n) (BitSize<n>::Size - 1)
#define DEBUG !defined(ONLINE_JUDGE)
#define SZ(x) ((int)(x).size())
#define ALL(x) begin(x), end(x)
#define RALL(x) (x).rbegin(),(x).rend()
template<typename TH>void _dbg(const char*sdbg,TH h){cerr<<sdbg<<"="<<h<<"\n";}template<typename TH,typename... TA>void _dbg(const char*sdbg,TH h,TA... t){while(*sdbg!=',')cerr<<*sdbg++;cerr<<"="<<h<<",";_dbg(sdbg+1,t...);}
#ifdef DEBUG
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#define debugv(x) {{cerr <<#x <<" = "; for(auto itt: x) cerr <<*itt <<", "; cerr <<"\n"; }}
#else
#define debug(...) (__VA_ARGS__)
#define debugv(x)
#define cerr if(0)cout
#endif
}namespace ____{template<typename T>int min_rotation(vector<T>s){int a=0,N=s.size();for(int b=0;b<N;b++)for(int i=0;i<N;i++){if(a+i==b||s[(a+i)%N]<s[(b+i)%N]){b+=max(0,i-1);break;}if(s[(a+i)%N]>s[(b+i)%N]){a=b;break;}}return a;};template<typename T>class StackGuard{private:T x;public:StackGuard(T x):x(x){}~StackGuard(){x();}};}namespace ____{};
namespace ____{
  const int maxn=2e5+7;
  const int maxblocks=300;
  int n,m,q;
  int p[maxn],pr[maxn];
  int a[maxn];
  char res[maxn];
  int cn[maxblocks][maxn];
  int mi[maxn];
  int main(){
    srand(GRANDOM);
    cn[0][0]=maxn;
    cin>>n>>m>>q;
    for(int i=1;i<=n;i++){cin>>p[i];pr[p[i]]=i;}
    for(int i=0;i<m;i++){
      cin>>a[i];a[i]=pr[a[i]];
    }
    int bs=max(1,n/maxblocks+1);
    memset(cn,0,sizeof(cn));
    for(int i=0;i<m;i+=bs){
      int ii=i/bs;
      for(int j=1;j<=n;j++)mi[j]=j,cn[ii][j]=j;
      for(int j=i,je=min(m,i+bs);j<je;j++){
        int x=a[j];
        mi[x]=min(mi[x],x);
        if(x>1)mi[x]=min(mi[x],mi[x-1]);
      }
      int last=-1,lastv=-1;
      for(int j=1;j<=n;j++){
        if(mi[j]<=j){
          if(last>0){
            for(int k=last;k<mi[j];k++){
              cn[ii][k]=lastv+1;
            }
          }
          last=mi[j];
          lastv=j;
        }
      }
      if(last>0){
        for(int k=last;k<=lastv;k++){
          cn[ii][k]=lastv+1;
        }
      }
    }
    res[q]=0;
    for(int i=0;i<q;i++){
      int l,r;cin>>l>>r;l--;r--;
      int nxt=1;
      int sl=l;
      for(int z=0;z<2&&nxt<=n;z++){
        l=sl;
        while(l<=r&&(l%bs)&&nxt<=n){
          if(a[l]==nxt)nxt++;
          l++;
        }
        while(l+bs<=r-2&&nxt<=n){
          nxt=cn[l/bs][nxt];
          l+=bs;
        }
        while(l<=r&&nxt<=n){
          if(a[l]==nxt)nxt++;
          l++;
        }
      }
      res[i]=(nxt==n+1)?'1':'0';
    }
    cout<<res<<endl;
    return 0;
  }
};
int main(int argc,char*argv[]){
  std::cin.sync_with_stdio(false);std::cin.tie(nullptr);
  return ____::main();
}


#pragma GCC optimize("O3")
#ifdef ONLINE_JUDGE
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#endif
#pragma GCC optimize("unroll-loops")
#pragma comment(linker, "/stack:200000000")
#include <bits/stdc++.h>
#include <deque>
#include <type_traits>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
template<typename KeyType=int,typename Mapped=__gnu_pbds::null_type,typename Cmp_Fn=std::less<KeyType>,typename Tag=__gnu_pbds::rb_tree_tag,template<typename Const_Node_Iterator,typename Node_Iterator,typename Cmp_Fn_,typename Allocator_>class Node_Update=__gnu_pbds::tree_order_statistics_node_update,typename Allocator=std::allocator<char>>using ordered_set_t=__gnu_pbds::tree<KeyType,Mapped,Cmp_Fn,Tag,Node_Update,Allocator>;const int GRANDOM=std::chrono::high_resolution_clock::now().time_since_epoch().count();struct ghash{int operator()(int x){return std::hash<int>{}(x^GRANDOM);}};template<typename KeyType>using hash_table_t=__gnu_pbds::gp_hash_table<KeyType,int,ghash>;namespace ____{template<class T>struct like_array:is_array<T>{};template<class T,size_t N>struct like_array<array<T,N>>:true_type{};template<class T>struct like_array<vector<T>>:true_type{};template<class T>bool is_like_array(const T&a){return like_array<T>::value;}template<class T>void _R(T&x){std::cin>>x;}inline void _R(int&x){scanf("%d",&x);}inline void _R(int64_t&x){scanf("%" SCNd64,&x);}inline void _R(double&x){scanf("%lf",&x);}inline void _R(char&x){scanf(" %c",&x);}inline void _R(char*x){scanf("%s",x);}inline void R(){}template<class T,class... U>inline void R(T&head,U&... tail){_R(head);R(tail...);}template<class T>void _W(const T&x){cout<<x;}inline void _W(const int&x){printf("%d",x);}inline void _W(const int64_t&x){printf("%" PRId64,x);}inline void _W(const double&x){printf("%.16f",x);}inline void _W(const char&x){putchar(x);}inline void _W(const char*x){printf("%s",x);}template<class T>inline void _W(const vector<T>&x){for(auto i=x.begin();i!=x.end();_W(*i++))if(i!=x.cbegin())putchar(' ');}inline void W(){}template<class T,class... U>inline void W(const T&head,const U&... tail){_W(head);if(sizeof...(tail))putchar(' '),W(tail...);}template<class T,class... U>inline void WL(const T&head,const U&... tail){_W(head);putchar(sizeof...(tail)? ' ':'\n');W(tail...);}template<class T>void _RE(T&x){cin>>x;}template<class Arg,class... Args>void _RE(Arg&first,Args&... rest);void _RE(double&x){string t;_RE(t);x=stod(t);}void _RE(long double&x){string t;_RE(t);x=stold(t);}template<class T>void _RE(complex<T>&x);template<class T1,class T2>void _RE(pair<T1,T2>&p);template<class T>void _RE(vector<T>&a);template<class T,size_t SZ>void _RE(array<T,SZ>&a);template<class Arg,class... Args>void _RE(Arg&first,Args&... rest){_RE(first);_RE(rest...);}template<class T>void _RE(complex<T>&x){T a,b;_RE(a,b);x=cd(a,b);}template<class T1,class T2>void _RE(pair<T1,T2>&p){_RE(p.f,p.s);}template<class T>void _RE(vector<T>&a){for(int i=0,ie=sz(a);i<ie;i++)_RE(a[i]);}template<class T,size_t SZ>void _RE(array<T,SZ>&a){for(int i=0;i<SZ;i++)_RE(a[i]);}};
#define prec setprecision
namespace ____{typedef long long ll;typedef unsigned long long llu;template<typename T>T gcd(T m,T n){while(n){T t=m%n;m=n;n=t;};return m;}template<typename T>T exgcd(T a,T b,T&sa,T&ta){T q,r,sb=0,tb=1,sc,tc;sa=1,ta=0;if(b)do q=a/b,r=a-q*b,a=b,b=r,sc=sa-q*sb,sa=sb,sb=sc,tc=ta-q*tb,ta=tb,tb=tc;while(b);return a;}template<typename T>T mul_inv(T a,T b){T t1=a,t2=b,t3;T v1=1,v2=0,v3;T x;while(t2!=1)x=t1/t2,t3=t1-x*t2,v3=v1-x*v2,t1=t2,t2=t3,v1=v2,v2=v3;return(v2+b)%b;}template<typename T>T powmod(T a,T b,T MOD){if(b<0)return 0;T rv=1;while(b)(b%2)&&(rv=(rv*a)%MOD),a=a*a%MOD,b/=2;return rv;}template<typename T>inline T isqrt(T k){T r=sqrt((double)k)+1;while(r*r>k)r--;return r;}template<typename T>inline T icbrt(T k){T r=cbrt((double)k)+1;while(r*r*r>k)r--;return r;}template<typename T>bool mul_overflow(T&r,T a,T b){return __builtin_mul_overflow(a,b,&r);}template<ll n>struct BitSize{enum{Size=BitSize<n/2>::Size+1};};template<>struct BitSize<0>{enum{Size=1};};template<>struct BitSize<1>{enum{Size=1};};
#define BITSIZE(n) (BitSize<n>::Size)
#define TREESIZE(n) ((1<<(BitSize<n>::Size + 1))+7)
#define BITMAX(n) (BitSize<n>::Size - 1)
#define DEBUG !defined(ONLINE_JUDGE)
#define SZ(x) ((int)(x).size())
#define ALL(x) begin(x), end(x)
#define RALL(x) (x).rbegin(),(x).rend()
template<typename TH>void _dbg(const char*sdbg,TH h){cerr<<sdbg<<"="<<h<<"\n";}template<typename TH,typename... TA>void _dbg(const char*sdbg,TH h,TA... t){while(*sdbg!=',')cerr<<*sdbg++;cerr<<"="<<h<<",";_dbg(sdbg+1,t...);}
#ifdef DEBUG
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#define debugv(x) {{cerr <<#x <<" = "; for(auto itt: x) cerr <<*itt <<", "; cerr <<"\n"; }}
#else
#define debug(...) (__VA_ARGS__)
#define debugv(x)
#define cerr if(0)cout
#endif
}namespace ____{template<typename T>int min_rotation(vector<T>s){int a=0,N=s.size();for(int b=0;b<N;b++)for(int i=0;i<N;i++){if(a+i==b||s[(a+i)%N]<s[(b+i)%N]){b+=max(0,i-1);break;}if(s[(a+i)%N]>s[(b+i)%N]){a=b;break;}}return a;};template<typename T>class StackGuard{private:T x;public:StackGuard(T x):x(x){}~StackGuard(){x();}};}namespace ____{};
namespace ____{
  const int maxn=2e5+7;
  const int maxblocks=300;
  int n,m,q;
  int p[maxn],pr[maxn];
  int a[maxn];
  char res[maxn];
  int cn[maxblocks][maxn];
  int main(){
    srand(GRANDOM);
    cn[0][0]=maxn;
    cin>>n>>m>>q;
    for(int i=1;i<=n;i++){cin>>p[i];pr[p[i]]=i;}
    for(int i=1;i<=m;i++){cin>>a[i];a[i]=pr[a[i]];}
    cout<<'z'<<endl;
    return 0;
    res[q]=0;
    for(int i=0;i<q;i++){
      int l,r;cin>>l>>r;
      int nxt=1;
      for(int z=0;z<2;z++){
        for(int j=l;j<=r;j++){
          if(a[j]==nxt)nxt++;
        }
      }
      res[i]=(nxt==n+1)?'1':'0';
    }
    cout<<res<<endl;
    return 0;
  }
};
int main(int argc,char*argv[]){
  std::cin.sync_with_stdio(false);std::cin.tie(nullptr);
  return ____::main();
}


#pragma GCC optimize("O3")
#ifdef ONLINE_JUDGE
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#endif
#pragma GCC optimize("unroll-loops")
#pragma comment(linker, "/stack:200000000")
#include <bits/stdc++.h>
#include <deque>
#include <type_traits>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
template<typename KeyType=int,typename Mapped=__gnu_pbds::null_type,typename Cmp_Fn=std::less<KeyType>,typename Tag=__gnu_pbds::rb_tree_tag,template<typename Const_Node_Iterator,typename Node_Iterator,typename Cmp_Fn_,typename Allocator_>class Node_Update=__gnu_pbds::tree_order_statistics_node_update,typename Allocator=std::allocator<char>>using ordered_set_t=__gnu_pbds::tree<KeyType,Mapped,Cmp_Fn,Tag,Node_Update,Allocator>;const int GRANDOM=std::chrono::high_resolution_clock::now().time_since_epoch().count();struct ghash{int operator()(int x){return std::hash<int>{}(x^GRANDOM);}};template<typename KeyType>using hash_table_t=__gnu_pbds::gp_hash_table<KeyType,int,ghash>;namespace ____{template<class T>struct like_array:is_array<T>{};template<class T,size_t N>struct like_array<array<T,N>>:true_type{};template<class T>struct like_array<vector<T>>:true_type{};template<class T>bool is_like_array(const T&a){return like_array<T>::value;}template<class T>void _R(T&x){std::cin>>x;}inline void _R(int&x){scanf("%d",&x);}inline void _R(int64_t&x){scanf("%" SCNd64,&x);}inline void _R(double&x){scanf("%lf",&x);}inline void _R(char&x){scanf(" %c",&x);}inline void _R(char*x){scanf("%s",x);}inline void R(){}template<class T,class... U>inline void R(T&head,U&... tail){_R(head);R(tail...);}template<class T>void _W(const T&x){cout<<x;}inline void _W(const int&x){printf("%d",x);}inline void _W(const int64_t&x){printf("%" PRId64,x);}inline void _W(const double&x){printf("%.16f",x);}inline void _W(const char&x){putchar(x);}inline void _W(const char*x){printf("%s",x);}template<class T>inline void _W(const vector<T>&x){for(auto i=x.begin();i!=x.end();_W(*i++))if(i!=x.cbegin())putchar(' ');}inline void W(){}template<class T,class... U>inline void W(const T&head,const U&... tail){_W(head);if(sizeof...(tail))putchar(' '),W(tail...);}template<class T,class... U>inline void WL(const T&head,const U&... tail){_W(head);putchar(sizeof...(tail)? ' ':'\n');W(tail...);}template<class T>void _RE(T&x){cin>>x;}template<class Arg,class... Args>void _RE(Arg&first,Args&... rest);void _RE(double&x){string t;_RE(t);x=stod(t);}void _RE(long double&x){string t;_RE(t);x=stold(t);}template<class T>void _RE(complex<T>&x);template<class T1,class T2>void _RE(pair<T1,T2>&p);template<class T>void _RE(vector<T>&a);template<class T,size_t SZ>void _RE(array<T,SZ>&a);template<class Arg,class... Args>void _RE(Arg&first,Args&... rest){_RE(first);_RE(rest...);}template<class T>void _RE(complex<T>&x){T a,b;_RE(a,b);x=cd(a,b);}template<class T1,class T2>void _RE(pair<T1,T2>&p){_RE(p.f,p.s);}template<class T>void _RE(vector<T>&a){for(int i=0,ie=sz(a);i<ie;i++)_RE(a[i]);}template<class T,size_t SZ>void _RE(array<T,SZ>&a){for(int i=0;i<SZ;i++)_RE(a[i]);}};
#define prec setprecision
namespace ____{typedef long long ll;typedef unsigned long long llu;template<typename T>T gcd(T m,T n){while(n){T t=m%n;m=n;n=t;};return m;}template<typename T>T exgcd(T a,T b,T&sa,T&ta){T q,r,sb=0,tb=1,sc,tc;sa=1,ta=0;if(b)do q=a/b,r=a-q*b,a=b,b=r,sc=sa-q*sb,sa=sb,sb=sc,tc=ta-q*tb,ta=tb,tb=tc;while(b);return a;}template<typename T>T mul_inv(T a,T b){T t1=a,t2=b,t3;T v1=1,v2=0,v3;T x;while(t2!=1)x=t1/t2,t3=t1-x*t2,v3=v1-x*v2,t1=t2,t2=t3,v1=v2,v2=v3;return(v2+b)%b;}template<typename T>T powmod(T a,T b,T MOD){if(b<0)return 0;T rv=1;while(b)(b%2)&&(rv=(rv*a)%MOD),a=a*a%MOD,b/=2;return rv;}template<typename T>inline T isqrt(T k){T r=sqrt((double)k)+1;while(r*r>k)r--;return r;}template<typename T>inline T icbrt(T k){T r=cbrt((double)k)+1;while(r*r*r>k)r--;return r;}template<typename T>bool mul_overflow(T&r,T a,T b){return __builtin_mul_overflow(a,b,&r);}template<ll n>struct BitSize{enum{Size=BitSize<n/2>::Size+1};};template<>struct BitSize<0>{enum{Size=1};};template<>struct BitSize<1>{enum{Size=1};};
#define BITSIZE(n) (BitSize<n>::Size)
#define TREESIZE(n) ((1<<(BitSize<n>::Size + 1))+7)
#define BITMAX(n) (BitSize<n>::Size - 1)
#define DEBUG !defined(ONLINE_JUDGE)
#define SZ(x) ((int)(x).size())
#define ALL(x) begin(x), end(x)
#define RALL(x) (x).rbegin(),(x).rend()
template<typename TH>void _dbg(const char*sdbg,TH h){cerr<<sdbg<<"="<<h<<"\n";}template<typename TH,typename... TA>void _dbg(const char*sdbg,TH h,TA... t){while(*sdbg!=',')cerr<<*sdbg++;cerr<<"="<<h<<",";_dbg(sdbg+1,t...);}
#ifdef DEBUG
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#define debugv(x) {{cerr <<#x <<" = "; for(auto itt: x) cerr <<*itt <<", "; cerr <<"\n"; }}
#else
#define debug(...) (__VA_ARGS__)
#define debugv(x)
#define cerr if(0)cout
#endif
}namespace ____{template<typename T>int min_rotation(vector<T>s){int a=0,N=s.size();for(int b=0;b<N;b++)for(int i=0;i<N;i++){if(a+i==b||s[(a+i)%N]<s[(b+i)%N]){b+=max(0,i-1);break;}if(s[(a+i)%N]>s[(b+i)%N]){a=b;break;}}return a;};template<typename T>class StackGuard{private:T x;public:StackGuard(T x):x(x){}~StackGuard(){x();}};}namespace ____{};
namespace ____{
  const int maxn=2e5+7;
  const int maxblocks=300;
  int n,m,q;
  int p[maxn],pr[maxn];
  int a[maxn];
  char res[maxn];
  int cn[maxblocks][maxn];
  int mi[maxn];
  int main(){
    srand(GRANDOM);
    cn[0][0]=maxn;
    cin>>n>>m>>q;
    for(int i=1;i<=n;i++){cin>>p[i];pr[p[i]]=i;}
    for(int i=0;i<m;i++){
      cin>>a[i];a[i]=pr[a[i]];
    }
    int bs=max(1,n/maxblocks+1);
    memset(cn,0,sizeof(cn));
    for(int i=0;i<m;i+=bs){
      int ii=i/bs;
      for(int j=1;j<=n;j++)mi[j]=n+1,cn[ii][j]=j;
      for(int j=i,je=min(m,i+bs);j<je;j++){
        int x=a[j];
        mi[x]=min(mi[x],x);
        if(x>1)mi[x]=min(mi[x],mi[x-1]);
      }
      int last=-1,lastv=-1;
      for(int j=1;j<=n;j++){
        if(mi[j]<=j){
          if(last>0){
            for(int k=last;k<mi[j];k++){
              cn[ii][k]=lastv+1;
            }
          }
          last=mi[j];
          lastv=j;
        }
      }
      if(last>0){
        for(int k=last;k<=lastv;k++){
          cn[ii][k]=lastv+1;
        }
      }
    }
    res[q]=0;
    for(int i=0;i<q;i++){
      int l,r;cin>>l>>r;l--;r--;
      int nxt=1;
      int sl=l;
      for(int z=0;z<2&&nxt<=n;z++){
        l=sl;
        while(l<=r&&(l%bs)&&nxt<=n){
          if(a[l]==nxt)nxt++;
          l++;
        }
        while(l+bs-1<=r&&nxt<=n){
          nxt=cn[l/bs][nxt];
          l+=bs;
        }
        while(l<=r&&nxt<=n){
          if(a[l]==nxt)nxt++;
          l++;
        }
      }
      res[i]=(nxt==n+1)?'1':'0';
    }
    cout<<res<<endl;
    return 0;
  }
};
int main(int argc,char*argv[]){
  std::cin.sync_with_stdio(false);std::cin.tie(nullptr);
  return ____::main();
}


#pragma GCC optimize("O3")
#ifdef ONLINE_JUDGE
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#endif
#pragma GCC optimize("unroll-loops")
#pragma comment(linker, "/stack:200000000")
#include <bits/stdc++.h>
#include <deque>
#include <type_traits>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
template<typename KeyType=int,typename Mapped=__gnu_pbds::null_type,typename Cmp_Fn=std::less<KeyType>,typename Tag=__gnu_pbds::rb_tree_tag,template<typename Const_Node_Iterator,typename Node_Iterator,typename Cmp_Fn_,typename Allocator_>class Node_Update=__gnu_pbds::tree_order_statistics_node_update,typename Allocator=std::allocator<char>>using ordered_set_t=__gnu_pbds::tree<KeyType,Mapped,Cmp_Fn,Tag,Node_Update,Allocator>;const int GRANDOM=std::chrono::high_resolution_clock::now().time_since_epoch().count();struct ghash{int operator()(int x){return std::hash<int>{}(x^GRANDOM);}};template<typename KeyType>using hash_table_t=__gnu_pbds::gp_hash_table<KeyType,int,ghash>;namespace ____{template<class T>struct like_array:is_array<T>{};template<class T,size_t N>struct like_array<array<T,N>>:true_type{};template<class T>struct like_array<vector<T>>:true_type{};template<class T>bool is_like_array(const T&a){return like_array<T>::value;}template<class T>void _R(T&x){std::cin>>x;}inline void _R(int&x){scanf("%d",&x);}inline void _R(int64_t&x){scanf("%" SCNd64,&x);}inline void _R(double&x){scanf("%lf",&x);}inline void _R(char&x){scanf(" %c",&x);}inline void _R(char*x){scanf("%s",x);}inline void R(){}template<class T,class... U>inline void R(T&head,U&... tail){_R(head);R(tail...);}template<class T>void _W(const T&x){cout<<x;}inline void _W(const int&x){printf("%d",x);}inline void _W(const int64_t&x){printf("%" PRId64,x);}inline void _W(const double&x){printf("%.16f",x);}inline void _W(const char&x){putchar(x);}inline void _W(const char*x){printf("%s",x);}template<class T>inline void _W(const vector<T>&x){for(auto i=x.begin();i!=x.end();_W(*i++))if(i!=x.cbegin())putchar(' ');}inline void W(){}template<class T,class... U>inline void W(const T&head,const U&... tail){_W(head);if(sizeof...(tail))putchar(' '),W(tail...);}template<class T,class... U>inline void WL(const T&head,const U&... tail){_W(head);putchar(sizeof...(tail)? ' ':'\n');W(tail...);}template<class T>void _RE(T&x){cin>>x;}template<class Arg,class... Args>void _RE(Arg&first,Args&... rest);void _RE(double&x){string t;_RE(t);x=stod(t);}void _RE(long double&x){string t;_RE(t);x=stold(t);}template<class T>void _RE(complex<T>&x);template<class T1,class T2>void _RE(pair<T1,T2>&p);template<class T>void _RE(vector<T>&a);template<class T,size_t SZ>void _RE(array<T,SZ>&a);template<class Arg,class... Args>void _RE(Arg&first,Args&... rest){_RE(first);_RE(rest...);}template<class T>void _RE(complex<T>&x){T a,b;_RE(a,b);x=cd(a,b);}template<class T1,class T2>void _RE(pair<T1,T2>&p){_RE(p.f,p.s);}template<class T>void _RE(vector<T>&a){for(int i=0,ie=sz(a);i<ie;i++)_RE(a[i]);}template<class T,size_t SZ>void _RE(array<T,SZ>&a){for(int i=0;i<SZ;i++)_RE(a[i]);}};
#define prec setprecision
namespace ____{typedef long long ll;typedef unsigned long long llu;template<typename T>T gcd(T m,T n){while(n){T t=m%n;m=n;n=t;};return m;}template<typename T>T exgcd(T a,T b,T&sa,T&ta){T q,r,sb=0,tb=1,sc,tc;sa=1,ta=0;if(b)do q=a/b,r=a-q*b,a=b,b=r,sc=sa-q*sb,sa=sb,sb=sc,tc=ta-q*tb,ta=tb,tb=tc;while(b);return a;}template<typename T>T mul_inv(T a,T b){T t1=a,t2=b,t3;T v1=1,v2=0,v3;T x;while(t2!=1)x=t1/t2,t3=t1-x*t2,v3=v1-x*v2,t1=t2,t2=t3,v1=v2,v2=v3;return(v2+b)%b;}template<typename T>T powmod(T a,T b,T MOD){if(b<0)return 0;T rv=1;while(b)(b%2)&&(rv=(rv*a)%MOD),a=a*a%MOD,b/=2;return rv;}template<typename T>inline T isqrt(T k){T r=sqrt((double)k)+1;while(r*r>k)r--;return r;}template<typename T>inline T icbrt(T k){T r=cbrt((double)k)+1;while(r*r*r>k)r--;return r;}template<typename T>bool mul_overflow(T&r,T a,T b){return __builtin_mul_overflow(a,b,&r);}template<ll n>struct BitSize{enum{Size=BitSize<n/2>::Size+1};};template<>struct BitSize<0>{enum{Size=1};};template<>struct BitSize<1>{enum{Size=1};};
#define BITSIZE(n) (BitSize<n>::Size)
#define TREESIZE(n) ((1<<(BitSize<n>::Size + 1))+7)
#define BITMAX(n) (BitSize<n>::Size - 1)
#define DEBUG !defined(ONLINE_JUDGE)
#define SZ(x) ((int)(x).size())
#define ALL(x) begin(x), end(x)
#define RALL(x) (x).rbegin(),(x).rend()
template<typename TH>void _dbg(const char*sdbg,TH h){cerr<<sdbg<<"="<<h<<"\n";}template<typename TH,typename... TA>void _dbg(const char*sdbg,TH h,TA... t){while(*sdbg!=',')cerr<<*sdbg++;cerr<<"="<<h<<",";_dbg(sdbg+1,t...);}
#ifdef DEBUG
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#define debugv(x) {{cerr <<#x <<" = "; for(auto itt: x) cerr <<*itt <<", "; cerr <<"\n"; }}
#else
#define debug(...) (__VA_ARGS__)
#define debugv(x)
#define cerr if(0)cout
#endif
}namespace ____{template<typename T>int min_rotation(vector<T>s){int a=0,N=s.size();for(int b=0;b<N;b++)for(int i=0;i<N;i++){if(a+i==b||s[(a+i)%N]<s[(b+i)%N]){b+=max(0,i-1);break;}if(s[(a+i)%N]>s[(b+i)%N]){a=b;break;}}return a;};template<typename T>class StackGuard{private:T x;public:StackGuard(T x):x(x){}~StackGuard(){x();}};}namespace ____{};
namespace ____{
  const int maxn=2e5+7;
  const int maxblocks=300;
  int n,m,q;
  int p[maxn],pr[maxn];
  int a[maxn];
  char res[maxn];
  int cn[maxblocks][maxn];
  int mi[maxn];
  int main(){
    srand(GRANDOM);
    cn[0][0]=maxn;
    cin>>n>>m>>q;
    for(int i=1;i<=n;i++){cin>>p[i];pr[p[i]]=i;}
    for(int i=0;i<m;i++){
      cin>>a[i];a[i]=pr[a[i]];
    }
    int bs=max(1,n/maxblocks+7);
    memset(cn,0,sizeof(cn));
    for(int i=0;i<m;i+=bs){
      int ii=i/bs;
      for(int j=1;j<=n;j++)mi[j]=n+1,cn[ii][j]=j;
      for(int j=i,je=min(m,i+bs);j<je;j++){
        int x=a[j];
        mi[x]=min(mi[x],x);
        if(x>1)mi[x]=min(mi[x],mi[x-1]);
      }
      int last=-1,lastv=-1;
      for(int j=1;j<=n;j++){
        if(mi[j]<=j){
          if(last>0){
            for(int k=last;k<mi[j];k++){
              cn[ii][k]=lastv+1;
            }
          }else{
            for(int k=1;k<mi[j];k++)cn[ii][k]=k;
          }
          last=mi[j];
          lastv=j;
        }
      }
      if(last>0){
        for(int k=last;k<=lastv;k++){
          cn[ii][k]=lastv+1;
        }
      }
    }
    res[q]=0;
    for(int i=0;i<q;i++){
      int l,r;cin>>l>>r;l--;r--;
      int nxt=1;
      int sl=l;
      for(int z=0;z<2&&nxt<=n;z++){
        l=sl;
        while(l<=r&&(l%bs)&&nxt<=n){
          if(a[l]==nxt)nxt++;
          l++;
        }
        while(l+bs-1<=r&&nxt<=n){
          int nn=cn[l/bs][nxt];
          if(nn)nxt=nn;
          l+=bs;
        }
        while(l<=r&&nxt<=n){
          if(a[l]==nxt)nxt++;
          l++;
        }
      }
      res[i]=(nxt==n+1)?'1':'0';
    }
    cout<<res<<endl;
    return 0;
  }
};
int main(int argc,char*argv[]){
  std::cin.sync_with_stdio(false);std::cin.tie(nullptr);
  return ____::main();
}


#pragma GCC optimize("O3")
#ifdef ONLINE_JUDGE
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#endif
#pragma GCC optimize("unroll-loops")
#pragma comment(linker, "/stack:200000000")
#include <bits/stdc++.h>
#include <deque>
#include <type_traits>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
template<typename KeyType=int,typename Mapped=__gnu_pbds::null_type,typename Cmp_Fn=std::less<KeyType>,typename Tag=__gnu_pbds::rb_tree_tag,template<typename Const_Node_Iterator,typename Node_Iterator,typename Cmp_Fn_,typename Allocator_>class Node_Update=__gnu_pbds::tree_order_statistics_node_update,typename Allocator=std::allocator<char>>using ordered_set_t=__gnu_pbds::tree<KeyType,Mapped,Cmp_Fn,Tag,Node_Update,Allocator>;const int GRANDOM=std::chrono::high_resolution_clock::now().time_since_epoch().count();struct ghash{int operator()(int x){return std::hash<int>{}(x^GRANDOM);}};template<typename KeyType>using hash_table_t=__gnu_pbds::gp_hash_table<KeyType,int,ghash>;namespace ____{template<class T>struct like_array:is_array<T>{};template<class T,size_t N>struct like_array<array<T,N>>:true_type{};template<class T>struct like_array<vector<T>>:true_type{};template<class T>bool is_like_array(const T&a){return like_array<T>::value;}template<class T>void _R(T&x){std::cin>>x;}inline void _R(int&x){scanf("%d",&x);}inline void _R(int64_t&x){scanf("%" SCNd64,&x);}inline void _R(double&x){scanf("%lf",&x);}inline void _R(char&x){scanf(" %c",&x);}inline void _R(char*x){scanf("%s",x);}inline void R(){}template<class T,class... U>inline void R(T&head,U&... tail){_R(head);R(tail...);}template<class T>void _W(const T&x){cout<<x;}inline void _W(const int&x){printf("%d",x);}inline void _W(const int64_t&x){printf("%" PRId64,x);}inline void _W(const double&x){printf("%.16f",x);}inline void _W(const char&x){putchar(x);}inline void _W(const char*x){printf("%s",x);}template<class T>inline void _W(const vector<T>&x){for(auto i=x.begin();i!=x.end();_W(*i++))if(i!=x.cbegin())putchar(' ');}inline void W(){}template<class T,class... U>inline void W(const T&head,const U&... tail){_W(head);if(sizeof...(tail))putchar(' '),W(tail...);}template<class T,class... U>inline void WL(const T&head,const U&... tail){_W(head);putchar(sizeof...(tail)? ' ':'\n');W(tail...);}template<class T>void _RE(T&x){cin>>x;}template<class Arg,class... Args>void _RE(Arg&first,Args&... rest);void _RE(double&x){string t;_RE(t);x=stod(t);}void _RE(long double&x){string t;_RE(t);x=stold(t);}template<class T>void _RE(complex<T>&x);template<class T1,class T2>void _RE(pair<T1,T2>&p);template<class T>void _RE(vector<T>&a);template<class T,size_t SZ>void _RE(array<T,SZ>&a);template<class Arg,class... Args>void _RE(Arg&first,Args&... rest){_RE(first);_RE(rest...);}template<class T>void _RE(complex<T>&x){T a,b;_RE(a,b);x=cd(a,b);}template<class T1,class T2>void _RE(pair<T1,T2>&p){_RE(p.f,p.s);}template<class T>void _RE(vector<T>&a){for(int i=0,ie=sz(a);i<ie;i++)_RE(a[i]);}template<class T,size_t SZ>void _RE(array<T,SZ>&a){for(int i=0;i<SZ;i++)_RE(a[i]);}};
#define prec setprecision
namespace ____{typedef long long ll;typedef unsigned long long llu;template<typename T>T gcd(T m,T n){while(n){T t=m%n;m=n;n=t;};return m;}template<typename T>T exgcd(T a,T b,T&sa,T&ta){T q,r,sb=0,tb=1,sc,tc;sa=1,ta=0;if(b)do q=a/b,r=a-q*b,a=b,b=r,sc=sa-q*sb,sa=sb,sb=sc,tc=ta-q*tb,ta=tb,tb=tc;while(b);return a;}template<typename T>T mul_inv(T a,T b){T t1=a,t2=b,t3;T v1=1,v2=0,v3;T x;while(t2!=1)x=t1/t2,t3=t1-x*t2,v3=v1-x*v2,t1=t2,t2=t3,v1=v2,v2=v3;return(v2+b)%b;}template<typename T>T powmod(T a,T b,T MOD){if(b<0)return 0;T rv=1;while(b)(b%2)&&(rv=(rv*a)%MOD),a=a*a%MOD,b/=2;return rv;}template<typename T>inline T isqrt(T k){T r=sqrt((double)k)+1;while(r*r>k)r--;return r;}template<typename T>inline T icbrt(T k){T r=cbrt((double)k)+1;while(r*r*r>k)r--;return r;}template<typename T>bool mul_overflow(T&r,T a,T b){return __builtin_mul_overflow(a,b,&r);}template<ll n>struct BitSize{enum{Size=BitSize<n/2>::Size+1};};template<>struct BitSize<0>{enum{Size=1};};template<>struct BitSize<1>{enum{Size=1};};
#define BITSIZE(n) (BitSize<n>::Size)
#define TREESIZE(n) ((1<<(BitSize<n>::Size + 1))+7)
#define BITMAX(n) (BitSize<n>::Size - 1)
#define DEBUG !defined(ONLINE_JUDGE)
#define SZ(x) ((int)(x).size())
#define ALL(x) begin(x), end(x)
#define RALL(x) (x).rbegin(),(x).rend()
template<typename TH>void _dbg(const char*sdbg,TH h){cerr<<sdbg<<"="<<h<<"\n";}template<typename TH,typename... TA>void _dbg(const char*sdbg,TH h,TA... t){while(*sdbg!=',')cerr<<*sdbg++;cerr<<"="<<h<<",";_dbg(sdbg+1,t...);}
#ifdef DEBUG
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#define debugv(x) {{cerr <<#x <<" = "; for(auto itt: x) cerr <<*itt <<", "; cerr <<"\n"; }}
#else
#define debug(...) (__VA_ARGS__)
#define debugv(x)
#define cerr if(0)cout
#endif
}namespace ____{template<typename T>int min_rotation(vector<T>s){int a=0,N=s.size();for(int b=0;b<N;b++)for(int i=0;i<N;i++){if(a+i==b||s[(a+i)%N]<s[(b+i)%N]){b+=max(0,i-1);break;}if(s[(a+i)%N]>s[(b+i)%N]){a=b;break;}}return a;};template<typename T>class StackGuard{private:T x;public:StackGuard(T x):x(x){}~StackGuard(){x();}};}namespace ____{};
namespace ____{
  const int maxn=2e5+7;
  const int maxblocks=300;
  int n,m,q;
  int p[maxn],pr[maxn];
  int a[maxn];
  char res[maxn];
  int cn[maxblocks][maxn];
  int mi[maxn];
  int main(){
    srand(GRANDOM);
    cn[0][0]=maxn;
    cin>>n>>m>>q;
    for(int i=1;i<=n;i++){cin>>p[i];pr[p[i]]=i;}
    for(int i=0;i<m;i++){
      cin>>a[i];a[i]=pr[a[i]];
    }
    int bs=max(1,n/maxblocks+1);
    memset(cn,0,sizeof(cn));
    for(int i=0;i<m;i+=bs){
      int ii=i/bs;
      for(int j=1;j<=n;j++)mi[j]=n+1,cn[ii][j]=j;
      for(int j=i,je=min(m,i+bs);j<je;j++){
        int x=a[j];
        mi[x]=min(mi[x],x);
        if(x>1)mi[x]=min(mi[x],mi[x-1]);
      }
      int last=-1,lastv=-1;
      for(int j=1;j<=n;j++){
        if(mi[j]<=j){
          if(last>0){
            for(int k=last,ke=mi[j];k<ke;k++){
              cn[ii][k]=lastv+1;
            }
          }
          last=mi[j];
          lastv=j;
        }else{
          if(last>0){
            for(int k=last;k<=lastv;k++){
              cn[ii][k]=lastv+1;
            }
          }
          last=lastv=-1;
        }
      }
      if(last>0){
        for(int k=last;k<=lastv;k++){
          cn[ii][k]=lastv+1;
        }
      }
    }
    res[q]=0;
    for(int i=0;i<q;i++){
      int l,r;cin>>l>>r;l--;r--;
      int nxt=1;
      int sl=l;
      for(int z=0;z<2&&nxt<=n;z++){
        l=sl;
        while(l<=r&&(l%bs)&&nxt<=n){
          if(a[l]==nxt)nxt++;
          l++;
        }
        while(l+bs-1<=r&&nxt<=n){
          int nn=cn[l/bs][nxt];
          if(nn)nxt=nn;
          l+=bs;
        }
        while(l<=r&&nxt<=n){
          if(a[l]==nxt)nxt++;
          l++;
        }
      }
      res[i]=(nxt==n+1)?'1':'0';
    }
    cout<<res<<endl;
    return 0;
  }
};
int main(int argc,char*argv[]){
  std::cin.sync_with_stdio(false);std::cin.tie(nullptr);
  return ____::main();
}


#pragma GCC optimize("O3")
#ifdef ONLINE_JUDGE
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#endif
#pragma GCC optimize("unroll-loops")
#pragma comment(linker, "/stack:200000000")
#include <bits/stdc++.h>
#include <deque>
#include <type_traits>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
template<typename KeyType=int,typename Mapped=__gnu_pbds::null_type,typename Cmp_Fn=std::less<KeyType>,typename Tag=__gnu_pbds::rb_tree_tag,template<typename Const_Node_Iterator,typename Node_Iterator,typename Cmp_Fn_,typename Allocator_>class Node_Update=__gnu_pbds::tree_order_statistics_node_update,typename Allocator=std::allocator<char>>using ordered_set_t=__gnu_pbds::tree<KeyType,Mapped,Cmp_Fn,Tag,Node_Update,Allocator>;const int GRANDOM=std::chrono::high_resolution_clock::now().time_since_epoch().count();struct ghash{int operator()(int x){return std::hash<int>{}(x^GRANDOM);}};template<typename KeyType>using hash_table_t=__gnu_pbds::gp_hash_table<KeyType,int,ghash>;namespace ____{template<class T>struct like_array:is_array<T>{};template<class T,size_t N>struct like_array<array<T,N>>:true_type{};template<class T>struct like_array<vector<T>>:true_type{};template<class T>bool is_like_array(const T&a){return like_array<T>::value;}template<class T>void _R(T&x){std::cin>>x;}inline void _R(int&x){scanf("%d",&x);}inline void _R(int64_t&x){scanf("%" SCNd64,&x);}inline void _R(double&x){scanf("%lf",&x);}inline void _R(char&x){scanf(" %c",&x);}inline void _R(char*x){scanf("%s",x);}inline void R(){}template<class T,class... U>inline void R(T&head,U&... tail){_R(head);R(tail...);}template<class T>void _W(const T&x){cout<<x;}inline void _W(const int&x){printf("%d",x);}inline void _W(const int64_t&x){printf("%" PRId64,x);}inline void _W(const double&x){printf("%.16f",x);}inline void _W(const char&x){putchar(x);}inline void _W(const char*x){printf("%s",x);}template<class T>inline void _W(const vector<T>&x){for(auto i=x.begin();i!=x.end();_W(*i++))if(i!=x.cbegin())putchar(' ');}inline void W(){}template<class T,class... U>inline void W(const T&head,const U&... tail){_W(head);if(sizeof...(tail))putchar(' '),W(tail...);}template<class T,class... U>inline void WL(const T&head,const U&... tail){_W(head);putchar(sizeof...(tail)? ' ':'\n');W(tail...);}template<class T>void _RE(T&x){cin>>x;}template<class Arg,class... Args>void _RE(Arg&first,Args&... rest);void _RE(double&x){string t;_RE(t);x=stod(t);}void _RE(long double&x){string t;_RE(t);x=stold(t);}template<class T>void _RE(complex<T>&x);template<class T1,class T2>void _RE(pair<T1,T2>&p);template<class T>void _RE(vector<T>&a);template<class T,size_t SZ>void _RE(array<T,SZ>&a);template<class Arg,class... Args>void _RE(Arg&first,Args&... rest){_RE(first);_RE(rest...);}template<class T>void _RE(complex<T>&x){T a,b;_RE(a,b);x=cd(a,b);}template<class T1,class T2>void _RE(pair<T1,T2>&p){_RE(p.f,p.s);}template<class T>void _RE(vector<T>&a){for(int i=0,ie=sz(a);i<ie;i++)_RE(a[i]);}template<class T,size_t SZ>void _RE(array<T,SZ>&a){for(int i=0;i<SZ;i++)_RE(a[i]);}};
#define prec setprecision
namespace ____{typedef long long ll;typedef unsigned long long llu;template<typename T>T gcd(T m,T n){while(n){T t=m%n;m=n;n=t;};return m;}template<typename T>T exgcd(T a,T b,T&sa,T&ta){T q,r,sb=0,tb=1,sc,tc;sa=1,ta=0;if(b)do q=a/b,r=a-q*b,a=b,b=r,sc=sa-q*sb,sa=sb,sb=sc,tc=ta-q*tb,ta=tb,tb=tc;while(b);return a;}template<typename T>T mul_inv(T a,T b){T t1=a,t2=b,t3;T v1=1,v2=0,v3;T x;while(t2!=1)x=t1/t2,t3=t1-x*t2,v3=v1-x*v2,t1=t2,t2=t3,v1=v2,v2=v3;return(v2+b)%b;}template<typename T>T powmod(T a,T b,T MOD){if(b<0)return 0;T rv=1;while(b)(b%2)&&(rv=(rv*a)%MOD),a=a*a%MOD,b/=2;return rv;}template<typename T>inline T isqrt(T k){T r=sqrt((double)k)+1;while(r*r>k)r--;return r;}template<typename T>inline T icbrt(T k){T r=cbrt((double)k)+1;while(r*r*r>k)r--;return r;}template<typename T>bool mul_overflow(T&r,T a,T b){return __builtin_mul_overflow(a,b,&r);}template<ll n>struct BitSize{enum{Size=BitSize<n/2>::Size+1};};template<>struct BitSize<0>{enum{Size=1};};template<>struct BitSize<1>{enum{Size=1};};
#define BITSIZE(n) (BitSize<n>::Size)
#define TREESIZE(n) ((1<<(BitSize<n>::Size + 1))+7)
#define BITMAX(n) (BitSize<n>::Size - 1)
#define DEBUG !defined(ONLINE_JUDGE)
#define SZ(x) ((int)(x).size())
#define ALL(x) begin(x), end(x)
#define RALL(x) (x).rbegin(),(x).rend()
template<typename TH>void _dbg(const char*sdbg,TH h){cerr<<sdbg<<"="<<h<<"\n";}template<typename TH,typename... TA>void _dbg(const char*sdbg,TH h,TA... t){while(*sdbg!=',')cerr<<*sdbg++;cerr<<"="<<h<<",";_dbg(sdbg+1,t...);}
#ifdef DEBUG
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#define debugv(x) {{cerr <<#x <<" = "; for(auto itt: x) cerr <<*itt <<", "; cerr <<"\n"; }}
#else
#define debug(...) (__VA_ARGS__)
#define debugv(x)
#define cerr if(0)cout
#endif
}namespace ____{template<typename T>int min_rotation(vector<T>s){int a=0,N=s.size();for(int b=0;b<N;b++)for(int i=0;i<N;i++){if(a+i==b||s[(a+i)%N]<s[(b+i)%N]){b+=max(0,i-1);break;}if(s[(a+i)%N]>s[(b+i)%N]){a=b;break;}}return a;};template<typename T>class StackGuard{private:T x;public:StackGuard(T x):x(x){}~StackGuard(){x();}};}namespace ____{};
namespace ____{
  const int maxn=2e5+7;
  const int maxblocks=300;
  int n,m,q;
  int p[maxn],pr[maxn];
  int a[maxn];
  char res[maxn];
  int cn[maxblocks][maxn];
  int mi[maxn];
  int main(){
    srand(GRANDOM);
    cn[0][0]=maxn;
    cin>>n>>m>>q;
    for(int i=1;i<=n;i++){cin>>p[i];pr[p[i]]=i;}
    for(int i=0;i<m;i++){
      cin>>a[i];a[i]=pr[a[i]];
    }
    int bs=max(3,n/maxblocks+1);
    memset(cn,0,sizeof(cn));
    for(int i=0;i<m;i+=bs){
      for(int j=1;j<=n;j++)mi[j]=n+1;
      for(int j=i,je=min(m,i+bs);j<je;j++){
        int x=a[j];
        mi[x]=min(mi[x],x);
        if(x>1)mi[x]=min(mi[x],mi[x-1]);
      }
      int ii=i/bs;
      int last=-1,lastv=-1;
      for(int j=1;j<=n;j++){
        if(mi[j]<=j){
          if(last>0){
            for(int k=last;k<mi[j];k++){
              cn[ii][k]=lastv;
            }
          }
          last=mi[j];
          lastv=j;
        }
      }
      if(last>0){
        for(int k=last;k<=lastv;k++){
          cn[ii][k]=lastv;
        }
      }
    }
    res[q]=0;
    for(int i=0;i<q;i++){
      int l,r;cin>>l>>r;l--;r--;
      int nxt=1;
      int sl=l;
      for(int z=0;z<2&&nxt<=n;z++){
        l=sl;
        while(l<r&&(l%bs)&&nxt<=n){
          if(a[l]==nxt)nxt++;
          l++;
        }
        while(l+bs<=r&&nxt<=n){
          int z=cn[l/bs][nxt];
          if(z)nxt=z+1;
          l+=bs;
        }
        while(l<=r&&nxt<=n){
          if(a[l]==nxt)nxt++;
          l++;
        }
      }
      res[i]=(nxt==n+1)?'1':'0';
    }
    cout<<res<<endl;
    return 0;
  }
};
int main(int argc,char*argv[]){
  std::cin.sync_with_stdio(false);std::cin.tie(nullptr);
  return ____::main();
}


#pragma GCC optimize("O3")
#ifdef ONLINE_JUDGE
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#endif
#pragma GCC optimize("unroll-loops")
#pragma comment(linker, "/stack:200000000")
#include <bits/stdc++.h>
#include <deque>
#include <type_traits>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
template<typename KeyType=int,typename Mapped=__gnu_pbds::null_type,typename Cmp_Fn=std::less<KeyType>,typename Tag=__gnu_pbds::rb_tree_tag,template<typename Const_Node_Iterator,typename Node_Iterator,typename Cmp_Fn_,typename Allocator_>class Node_Update=__gnu_pbds::tree_order_statistics_node_update,typename Allocator=std::allocator<char>>using ordered_set_t=__gnu_pbds::tree<KeyType,Mapped,Cmp_Fn,Tag,Node_Update,Allocator>;const int GRANDOM=std::chrono::high_resolution_clock::now().time_since_epoch().count();struct ghash{int operator()(int x){return std::hash<int>{}(x^GRANDOM);}};template<typename KeyType>using hash_table_t=__gnu_pbds::gp_hash_table<KeyType,int,ghash>;namespace ____{template<class T>struct like_array:is_array<T>{};template<class T,size_t N>struct like_array<array<T,N>>:true_type{};template<class T>struct like_array<vector<T>>:true_type{};template<class T>bool is_like_array(const T&a){return like_array<T>::value;}template<class T>void _R(T&x){std::cin>>x;}inline void _R(int&x){scanf("%d",&x);}inline void _R(int64_t&x){scanf("%" SCNd64,&x);}inline void _R(double&x){scanf("%lf",&x);}inline void _R(char&x){scanf(" %c",&x);}inline void _R(char*x){scanf("%s",x);}inline void R(){}template<class T,class... U>inline void R(T&head,U&... tail){_R(head);R(tail...);}template<class T>void _W(const T&x){cout<<x;}inline void _W(const int&x){printf("%d",x);}inline void _W(const int64_t&x){printf("%" PRId64,x);}inline void _W(const double&x){printf("%.16f",x);}inline void _W(const char&x){putchar(x);}inline void _W(const char*x){printf("%s",x);}template<class T>inline void _W(const vector<T>&x){for(auto i=x.begin();i!=x.end();_W(*i++))if(i!=x.cbegin())putchar(' ');}inline void W(){}template<class T,class... U>inline void W(const T&head,const U&... tail){_W(head);if(sizeof...(tail))putchar(' '),W(tail...);}template<class T,class... U>inline void WL(const T&head,const U&... tail){_W(head);putchar(sizeof...(tail)? ' ':'\n');W(tail...);}template<class T>void _RE(T&x){cin>>x;}template<class Arg,class... Args>void _RE(Arg&first,Args&... rest);void _RE(double&x){string t;_RE(t);x=stod(t);}void _RE(long double&x){string t;_RE(t);x=stold(t);}template<class T>void _RE(complex<T>&x);template<class T1,class T2>void _RE(pair<T1,T2>&p);template<class T>void _RE(vector<T>&a);template<class T,size_t SZ>void _RE(array<T,SZ>&a);template<class Arg,class... Args>void _RE(Arg&first,Args&... rest){_RE(first);_RE(rest...);}template<class T>void _RE(complex<T>&x){T a,b;_RE(a,b);x=cd(a,b);}template<class T1,class T2>void _RE(pair<T1,T2>&p){_RE(p.f,p.s);}template<class T>void _RE(vector<T>&a){for(int i=0,ie=sz(a);i<ie;i++)_RE(a[i]);}template<class T,size_t SZ>void _RE(array<T,SZ>&a){for(int i=0;i<SZ;i++)_RE(a[i]);}};
#define prec setprecision
namespace ____{typedef long long ll;typedef unsigned long long llu;template<typename T>T gcd(T m,T n){while(n){T t=m%n;m=n;n=t;};return m;}template<typename T>T exgcd(T a,T b,T&sa,T&ta){T q,r,sb=0,tb=1,sc,tc;sa=1,ta=0;if(b)do q=a/b,r=a-q*b,a=b,b=r,sc=sa-q*sb,sa=sb,sb=sc,tc=ta-q*tb,ta=tb,tb=tc;while(b);return a;}template<typename T>T mul_inv(T a,T b){T t1=a,t2=b,t3;T v1=1,v2=0,v3;T x;while(t2!=1)x=t1/t2,t3=t1-x*t2,v3=v1-x*v2,t1=t2,t2=t3,v1=v2,v2=v3;return(v2+b)%b;}template<typename T>T powmod(T a,T b,T MOD){if(b<0)return 0;T rv=1;while(b)(b%2)&&(rv=(rv*a)%MOD),a=a*a%MOD,b/=2;return rv;}template<typename T>inline T isqrt(T k){T r=sqrt((double)k)+1;while(r*r>k)r--;return r;}template<typename T>inline T icbrt(T k){T r=cbrt((double)k)+1;while(r*r*r>k)r--;return r;}template<typename T>bool mul_overflow(T&r,T a,T b){return __builtin_mul_overflow(a,b,&r);}template<ll n>struct BitSize{enum{Size=BitSize<n/2>::Size+1};};template<>struct BitSize<0>{enum{Size=1};};template<>struct BitSize<1>{enum{Size=1};};
#define BITSIZE(n) (BitSize<n>::Size)
#define TREESIZE(n) ((1<<(BitSize<n>::Size + 1))+7)
#define BITMAX(n) (BitSize<n>::Size - 1)
#define DEBUG !defined(ONLINE_JUDGE)
#define SZ(x) ((int)(x).size())
#define ALL(x) begin(x), end(x)
#define RALL(x) (x).rbegin(),(x).rend()
template<typename TH>void _dbg(const char*sdbg,TH h){cerr<<sdbg<<"="<<h<<"\n";}template<typename TH,typename... TA>void _dbg(const char*sdbg,TH h,TA... t){while(*sdbg!=',')cerr<<*sdbg++;cerr<<"="<<h<<",";_dbg(sdbg+1,t...);}
#ifdef DEBUG
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#define debugv(x) {{cerr <<#x <<" = "; for(auto itt: x) cerr <<*itt <<", "; cerr <<"\n"; }}
#else
#define debug(...) (__VA_ARGS__)
#define debugv(x)
#define cerr if(0)cout
#endif
}namespace ____{template<typename T>int min_rotation(vector<T>s){int a=0,N=s.size();for(int b=0;b<N;b++)for(int i=0;i<N;i++){if(a+i==b||s[(a+i)%N]<s[(b+i)%N]){b+=max(0,i-1);break;}if(s[(a+i)%N]>s[(b+i)%N]){a=b;break;}}return a;};template<typename T>class StackGuard{private:T x;public:StackGuard(T x):x(x){}~StackGuard(){x();}};}namespace ____{};
namespace ____{
  const int maxn=2e5+7;
  const int maxlog=BITSIZE(maxn)+1;
  const int maxblocks=300;
  int n,m,q;
  int p[maxn],pr[maxn];
  int a[maxn];
  int pos[maxn];
  int jmp[maxn][maxlog];
  int best[maxn];
  int main(){
    srand(GRANDOM);
    cin>>n>>m>>q;
    const int INF=maxn+1;
    for(int i=1;i<=n;i++){cin>>p[i];pr[p[i]]=i;}
    for(int i=0;i<m;i++){cin>>a[i];a[i]=pr[a[i]]-1;}
    for(int i=0;i<n;i++)pos[i]=INF;
    for(int i=m-1;i>=0;i--){
      jmp[i][0]=pos[(a[i]+1)%n];
      pos[a[i]]=i;
    }
    for(int j=1;j<maxlog;j++){
      for(int i=0;i<m;i++){
        if(jmp[i][j-1]==INF)jmp[i][j]=INF;
        else jmp[i][j]=jmp[jmp[i][j-1]][j-1];
      }
    }
    for(int i=0;i<m;i++){
      int idx=i;
      for(int j=maxlog-1;idx<m&&j>=0;j--)if((n-1)&(1<<j))idx=jmp[idx][j];
      best[i]=idx;
    }
    for(int i=m-2;i>=0;i--)best[i]=min(best[i],best[i+1]);
    for(int i=0;i<q;i++){
      int l,r;cin>>l>>r;
      l--;r--;
      if(best[l]<=r)cout<<1;
      else cout<<0;
    }
    cout<<endl;
    return 0;
  }
};
int main(int argc,char*argv[]){
  std::cin.sync_with_stdio(false);std::cin.tie(nullptr);
  return ____::main();
}


#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
//Codeforces Problem E
//Antoni D�ugosz
#include <bits/stdc++.h>
using namespace std;

const int MAXN=2e5+10;
const int LOG=19;
const int base=1<<18;

int tree[base*2];
int pos[MAXN];
int pa[MAXN][LOG];
int before[MAXN];
string ans;

void prep_pa(int m)
{
    int i,j;
    for(j=1;j<LOG;j++)
    {
        for(i=1;i<=m;i++)
        {
            pa[i][j]=pa[pa[i][j-1]][j-1];
        }
    }
}

void prep_tree()
{
    int i;
    for(i=base-1;i>=1;i--)
    {
        tree[i]=max(tree[i*2],tree[i*2+1]);
    }
}

int get(int a,int b)
{
    a+=base;
    b+=base;
    int ans=max(tree[a],tree[b]);
    while(a/2!=b/2)
    {
        if(a%2==0)
            ans=max(ans,tree[a+1]);
        if(b%2==1)
            ans=max(ans,tree[b-1]);
        a/=2;
        b/=2;
    }
    return ans;
}

int main()
{
    mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n,m,q,val,i,j,first,cost,ind,moves,last=0,res,l,r;
    cin>>n>>m>>q;
    for(i=1;i<=n;i++)
    {
        cin>>val;
        if(i==1)
            first=val;
        before[val]=last;
        last=val;
    }
    before[first]=last;
    for(i=1;i<=m;i++)
    {
        cin>>val;
        pa[i][0]=pos[before[val]];
        pos[val]=i;
    }
    prep_pa(m);
    for(i=1;i<=m;i++)
    {
        ind=i;
        moves=n-1;
        cost=base;
        for(j=LOG-1;j>=0;j--)
        {
            if(cost<=moves)
            {
                ind=pa[ind][j];
                moves-=cost;
            }
            cost/=2;
        }
        tree[base+i]=ind;
    }
    prep_tree();
    for(i=0;i<q;i++)
    {
        cin>>l>>r;
        res=get(l,r);
        if(res>=l)
            ans.push_back('1');
        else
            ans.push_back('0');
    }
    cout<<ans;
}


#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
//Codeforces Problem E
//Antoni D�ugosz
#include <bits/stdc++.h>
using namespace std;

const int MAXN=2e5+10;
const int LOG=19;
const int base=1<<18;

int tree[base*2];
int pos[MAXN];
int pa[MAXN][LOG];
int before[MAXN];
string ans;

void prep_pa(int m)
{
    int i,j;
    for(j=1;j<LOG;j++)
    {
        for(i=1;i<=m;i++)
        {
            pa[i][j]=pa[pa[i][j-1]][j-1];
        }
    }
}

void prep_tree()
{
    int i;
    for(i=base-1;i>=1;i--)
    {
        tree[i]=max(tree[i*2],tree[i*2+1]);
    }
}

int get(int a,int b)
{
    a+=base;
    b+=base;
    int ans=max(tree[a],tree[b]);
    while(a/2!=b/2)
    {
        if(a%2==0)
            ans=max(ans,tree[a+1]);
        if(b%2==1)
            ans=max(ans,tree[b-1]);
        a/=2;
        b/=2;
    }
    return ans;
}

int main()
{
    mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n,m,q,val,i,j,first,cost,ind,moves,last=0,res,l,r;
    cin>>n>>m>>q;
    for(i=1;i<=n;i++)
    {
        cin>>val;
        if(i==1)
            first=val;
        before[val]=last;
        last=val;
    }
    before[first]=last;
    for(i=1;i<=m;i++)
    {
        cin>>val;
        pa[i][0]=pos[before[val]];
        pos[val]=i;
    }
    prep_pa(m);
    for(i=1;i<=m;i++)
    {
        ind=i;
        moves=n-1;
        cost=base;
        for(j=LOG-1;j>=0;j--)
        {
            if(cost<=moves)
            {
                ind=pa[ind][j];
                moves-=cost;
            }
            cost/=2;
        }
        tree[base+i]=ind;
    }
    prep_tree();
    for(i=0;i<q;i++)
    {
        cin>>l>>r;
        res=get(l,r);
        if(res>=l)
            ans.push_back('1');
        else
            ans.push_back('0');
    }
    cout<<ans;
}


//Codeforces Problem E
//Antoni D�ugosz
#include <bits/stdc++.h>
using namespace std;

const int MAXN=2e5+10;
const int LOG=19;
const int base=1<<18;

int tree[base*2];
int pos[MAXN];
int pa[MAXN][LOG];
int before[MAXN];
string ans;

void prep_pa(int m)
{
    int i,j;
    for(j=1;j<LOG;j++)
    {
        for(i=1;i<=m;i++)
        {
            pa[i][j]=pa[pa[i][j-1]][j-1];
        }
    }
}

void prep_tree()
{
    int i;
    for(i=base-1;i>=1;i--)
    {
        tree[i]=max(tree[i*2],tree[i*2+1]);
    }
}

int get(int a,int b)
{
    a+=base;
    b+=base;
    int ans=max(tree[a],tree[b]);
    while(a/2!=b/2)
    {
        if(a%2==0)
            ans=max(ans,tree[a+1]);
        if(b%2==1)
            ans=max(ans,tree[b-1]);
        a/=2;
        b/=2;
    }
    return ans;
}

int main()
{
    mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n,m,q,val,i,j,first,cost,ind,moves,last=0,res,l,r;
    cin>>n>>m>>q;
    for(i=1;i<=n;i++)
    {
        cin>>val;
        if(i==1)
            first=val;
        before[val]=last;
        last=val;
    }
    before[first]=last;
    for(i=1;i<=m;i++)
    {
        cin>>val;
        pa[i][0]=pos[before[val]];
        pos[val]=i;
    }
    prep_pa(m);
    for(i=1;i<=m;i++)
    {
        ind=i;
        moves=n-1;
        cost=base;
        for(j=LOG-1;j>=0;j--)
        {
            if(cost<=moves)
            {
                ind=pa[ind][j];
                moves-=cost;
            }
            cost/=2;
        }
        tree[base+i]=ind;
    }
    prep_tree();
    for(i=0;i<q;i++)
    {
        cin>>l>>r;
        res=get(l,r);
        if(res>=l)
            ans.push_back('1');
        else
            ans.push_back('0');
    }
    cout<<ans;
}


#include<bits/stdc++.h>
#define In_the_name_of_allah_the_merciful ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define Alhamdulillah return 0;
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define ins insert
#define fi first
#define se second
#define pi pair<ll,ll>
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define sz(v) ((ll)((v).size()))
#define reset(v,val) memset(v,val,sizeof(v));
#define forn(i, x, n) for ( i = x; i<=(ll)(n); i++)
#define iforn(i, x, n) for( i = x; i<(ll)(n); i++)
#define rep(i, x, n) for ( i =x; i>=(ll)(n); i--)
#define irep(i, x, n) for( i =x; i>(ll)(n); i--)
using namespace std;
typedef  long long int  ll;
const long long  mod=1e9+7;
ll n,k,m,res=0,ans=0,sm=0,edge=-1,nb=1;
ll a[200005],b[200050],parent[200005]={0},nxt[200005];
multiset< ll >st,st1,st2;
set<ll>stres;
string s,s1,s2,s3,s4;
vector<ll>v[200005],vnode,vans,v3;
vector< pi >vv,vv1,adj,v1,v2;
vector< pair< int,pi> > vvv;
priority_queue <ll> q;
map< ll ,ll > mp;
multiset< ll > ::iterator it,it1,it2;
int voyel(char c){
	if(c=='a'||c=='e'||c=='i'||c=='o'||c=='u'||c=='y')return 1;
	return 0;
}
ll up[200005][21];
/******************************************/
void solve(){
     ll i,j;
     up[m+1][0]=m+1;
     for(i=1;i<=m;i++){
        ll nxtt=nxt[b[i]];
        ll idx=lower_bound(v[nxtt].begin(),v[nxtt].end(),i)-v[nxtt].begin();
        if(idx!=v[nxtt].size()){
            ll idxb=v[nxtt][idx];
            up[i][0]=idxb;
          }
          else up[i][0]=m+1;
     }
     for(ll j=1;j<20;j++){
        for(i=1;i<=m;i++)up[i][j]=up[up[i][j-1]][j-1];
        up[m+1][j]=m+1;
     }
     for(i=1;i<=m;i++){
        ll bsup=i;
        ll x=n-1;
        for(j=19;j>=0;j--){
            if((1LL<<j)<=x){
                x-=(1LL<<j);
                bsup=up[bsup][j];
            }
        }
        if(bsup<=m)vv.pb({i,bsup});
     }
}

vector<ll> tree[8000005];
/************************************************/
void build(ll node,ll start,ll end)
{
  	if(start==end){
		tree[node].push_back(a[start]);
    	}
		else{
		ll mid=(start+end)/2;
		build(2*node,start,mid);
		build(2*node+1,mid+1,end);
		merge(tree[2*node].begin(),tree[2*node].end(),tree[2*node+1].begin(),tree[2*node+1].end(),back_inserter(tree[node]));
	}
}
/***********************************************/
ll query(ll node,ll start,ll end,ll l,ll r,ll x)
{   ll ans=0;
    if(r<start or l>end)return 0;
    if(l<=start&&r>=end)return upper_bound(tree[node].begin(),tree[node].end(),x)-tree[node].begin();
    ll left,right;
    ll mid=(start+end)/2;
    left = query(2*node,start,mid,l,r,x);
    right = query(2*node+1,mid+1,end,l,r,x);
    ans=left+right;
    return ans;
}
/*********************************************/

int main(){
In_the_name_of_allah_the_merciful
	ll i=0,j=0,x,y,z=0,mx=0,nb0=0,nb1=0,nbmax=0,nbinf=0,mm=5e9,idx=0,ok=0,l,r,negatif=0,positif=0,q,d,res1=0;
	char c;
   //freopen("a.in","r",stdin);
   cin>>n>>m>>q;
   for(i=1;i<=n;i++){
    cin>>a[i];
   }
   for(i=1;i<=n;i++)nxt[a[i]]=a[i+1];
   nxt[a[n]]=a[1];
   for(i=1;i<=m;i++){
      cin>>b[i];
      v[b[i]].pb(i);
   }
   for(i=1;i<=n;i++)sort(v[i].begin(),v[i].end());
   memset(up,-1,sizeof(up));
   solve();
   sort(vv.begin(),vv.end());
   n=vv.size();
    forn(i,1,n){
       b[i]=vv[i-1].fi;
       a[i]=vv[i-1].se;
    }
    build(1,1,n);
    s="";
    while(q--){
        cin>>x>>y;
        idx=lower_bound(b+1,b+1+n,x)-b;
        res=query(1,1,n,idx,n,y);
        if(res!=0)s+='1';
        else s+='0';
    }
    cout<<s;
Alhamdulillah
 }


#include<bits/stdc++.h>
#define In_the_name_of_allah_the_merciful ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define Alhamdulillah return 0;
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define ins insert
#define fi first
#define se second
#define pi pair<ll,ll>
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define sz(v) ((ll)((v).size()))
#define reset(v,val) memset(v,val,sizeof(v));
#define forn(i, x, n) for ( i = x; i<=(ll)(n); i++)
#define iforn(i, x, n) for( i = x; i<(ll)(n); i++)
#define rep(i, x, n) for ( i =x; i>=(ll)(n); i--)
#define irep(i, x, n) for( i =x; i>(ll)(n); i--)
using namespace std;
typedef  long long int  ll;
const long long  mod=1e9+7;
ll n,k,m,res=0,ans=0,sm=0,edge=-1,nb=1;
ll a[500005],b[500050],dp[500005]={0},parent[500005]={0},nxt[500005];
multiset< ll >st,st1,st2;
set<ll>stres;
string s,s1,s2,s3,s4;
vector<ll>v[500005],vnode,vans,v3;
vector< pi >vv,vv1,adj,v1,v2;
vector< pair< int,pi> > vvv;
priority_queue <ll> q;
map< ll ,ll > mp;
multiset< ll > ::iterator it,it1,it2;
int voyel(char c){
	if(c=='a'||c=='e'||c=='i'||c=='o'||c=='u'||c=='y')return 1;
	return 0;
}
/******************************************/
ll solve(ll son,ll y){
     if(y==n){
        dp[son]=nb;
        return son ;
     }
     ll z=-1,idxb=son;
     ll nxtt=nxt[b[son]];
     ll idx=lower_bound(v[nxtt].begin(),v[nxtt].end(),son)-v[nxtt].begin();
     if(idx!=v[nxtt].size()){
        idxb=v[nxtt][idx];
          // idxb=parent[idxb];
            z= solve(parent[idxb],y+dp[idxb]);
     }
     nb+=dp[idxb];
    if(z!=-1)dp[son]=nb;
    else dp[son]=z;
     parent[son]=z;
     return z;
}

vector<ll> tree[10000005];
/************************************************/
void build(ll node,ll start,ll end)
{
  	if(start==end){
		tree[node].push_back(a[start]);
    	}
		else{
		ll mid=(start+end)/2;
		build(2*node,start,mid);
		build(2*node+1,mid+1,end);
		merge(tree[2*node].begin(),tree[2*node].end(),tree[2*node+1].begin(),tree[2*node+1].end(),back_inserter(tree[node]));
	}
}
/***********************************************/
ll query(ll node,ll start,ll end,ll l,ll r,ll x)
{   ll ans=0;
    if(r<start or l>end)return 0;
    if(l<=start&&r>=end)return upper_bound(tree[node].begin(),tree[node].end(),x)-tree[node].begin();
    ll left,right;
    ll mid=(start+end)/2;
    left = query(2*node,start,mid,l,r,x);
    right = query(2*node+1,mid+1,end,l,r,x);
    ans=left+right;
    return ans;
}
/*********************************************/

int main(){
In_the_name_of_allah_the_merciful
	ll i=0,j=0,x,y,z=0,mx=0,nb0=0,nb1=0,nbmax=0,nbinf=0,mm=5e9,idx=0,ok=0,l,r,negatif=0,positif=0,q,d,res1=0;
	char c;
  // freopen("a.in","r",stdin);
   ll t;
   cin>>n>>m>>q;
   for(i=1;i<=n;i++){
    cin>>a[i];
   }
   for(i=1;i<=n;i++)nxt[a[i]]=a[i+1];
   nxt[a[n]]=a[1];
   for(i=1;i<=m;i++){
      cin>>b[i];
      v[b[i]].pb(i);
      parent[i]=i;
      dp[i]=1;
   }
   for(i=1;i<=n;i++)sort(v[i].begin(),v[i].end());
   for(i=1;i<=m;i++){
       if(dp[i]==n){
          vv.pb({i,parent[i]});
          continue;
       }
       if(dp[i]==-1){
          dp[i]=1;
          parent[i]=i;
       }
       nb=1;
       //cout<<i<<" "<<dp[i]<<parent[i]<<endl;
       z=solve(i,1);
      /* if(z!=-1){
            parent[i]=z;
            dp[i]=dp[i]+dp[parent[i]]-1;
       }*/
      if(dp[i]>=(n)&&parent[i]!=-1) vv.pb({i,parent[i]});
   }
  // for(i=1;i<=m;i++)cout<<i<<" "<<" "<<dp[i]<<" "<<parent[i]<<" "<<b[parent[i]]<<endl;
   sort(vv.begin(),vv.end());
   n=vv.size();
    forn(i,1,n){
       b[i]=vv[i-1].fi;
       a[i]=vv[i-1].se;
    }
    build(1,1,n);
    s="";
    while(q--){
        cin>>x>>y;
        idx=lower_bound(b+1,b+1+n,x)-b;
        res=query(1,1,n,idx,n,y);
        if(res!=0)s+='1';
        else s+='0';
    }
    cout<<s;
Alhamdulillah
 }