#include "iostream"
#include "fstream"
#include "algorithm"
#include "iomanip"
#include "stack"
#include "queue"
#include "string"
#include "vector"
#include "map"
#include "set"
#include "list"
#include "deque"
#include "complex"
#include "bitset"
#include "cmath"
#include "unordered_set"
#include "unordered_map"
#include "iterator"
#include <ctime>
#include <cassert>
#include "numeric"
#include <cstdio>

using namespace std;

//#define f(i,n) for(int i=0; i<n;i++)
//#define rf(i, n) for(int i=n-1;i>=0;i--)
//#define forn(i, j, n) for(int i=j; i<n; i++)
//#define ff(i, j, n) f(i, n)f(j, n)
#define pb push_back
#define maxi(a,b) a = max(a, b);
#define mini(a,b) a = min(a, b);
#define endl '\n'
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define sqr(x) ((x) * (x))
#define SZ(a) ((int)(a.size()))
#define watch(x) cout << (#x) << " = " << x << endl;
//typedef long long ll;
typedef long double ld;
#define int long long
#define double ld
typedef map<int, int> mii;
typedef pair<int, int> pii;
typedef pair<string, int> psi;
typedef pair<int, string> pis;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<pii> vpii;
typedef vector<char> vc;

template<class T>
void show(const vector<T> &a)
{
	for (T x : a)
		cout << x << " ";
	cout << endl;
}

const int sze = 3e5 + 50, oo = 1e18 + 500, mod = 1e9 + 7;
const double eps = 1e-9, PI = 2 * acos(0.0);
vi vertices[sze];
vi visit(sze, 0);
vc used(sze, false);
vi arr(sze, 0);
int n, m, k;
int A, B;
int cnt = 0;

const int N = 1 << 18;
vi t(N << 1, oo);

void build(vi &a)
{
	for (int i = 0; i < m; i++)
	{
		t[i + N] = a[i];
	}

	for (int i = N - 1; i; i--)
	{
		t[i] = min(t[i << 1], t[i << 1 | 1]);
	}
}

int get(int v, int tl, int tr, int l, int r)
{
	if (tl == l && tr == r)
	{
		return t[v];
	}

	int md = (tl + tr) >> 1;
	int ans = oo;
	if (l <= md)
	{
		mini(ans, get(v << 1, tl, md, l, min(r, md)));
	}

	if (r > md)
	{
		mini(ans, get(v << 1 | 1, md+1, tr, max(l, md+1), r));
	}

	return ans;
}

int dp[sze][20];

signed main()
{
	ios::sync_with_stdio(0);
	cout.tie(0); cin.tie(0);
	/*freopen("stars.in", "r", stdin);
	freopen("stars.out", "w", stdout);*/

	cin >> n >> m >> k;
	vi p(n), a(m);
	vi nxt(n + 10);

	for (int i = 0; i < n;i++)
	{
		cin >> p[i];
	}

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

	vi ptr(n + 10, 0);

	for (int i = 0; i < m; i++)
	{
		cin >> a[i];
		vertices[a[i]].pb(i);
	}

	for (int i = 0; i < m; i++)
	{
		int v = nxt[a[i]];
		while (ptr[v] < SZ(vertices[v]) && vertices[v][ptr[v]] < i)
		{
			ptr[v] ++;
		}

		if (ptr[v] < SZ(vertices[v]))
		{
			a[i] = vertices[v][ptr[v]];
		}
		else
		{
			a[i] = oo;
		}
	}

	for (int i =0; i <= m; i++)
	{
		for (int j = 0; j < 20; j++)
		{
			dp[i][j] = oo;
		}
	}

	for (int i = m - 1; i >= 0; i --)
	{
		dp[i][0] = a[i];
		for (int j = 1; j < 20; j++)
		{
			if (dp[i][j - 1] != oo)
				dp[i][j] = dp[dp[i][j - 1]][j - 1];
			else
				break;
		}
	}

	for (int i = 0; i < m; i++)
	{
		int val = n - 2;
		int ind = i;
		for (int j = 19; j >= 0; j--)
		{
			if (1 << j <= val)
			{
				ind = dp[ind][j];
				val -= 1 << j;
				if (ind == oo)
					break;
			}
		}

		if (ind != oo)
			a[i] = a[ind];
		else
			a[i] = oo;
	}

	vi leftmost(m);
	leftmost[m-1] = a[m-1];
	for (int i = m-2; i >= 0; i--)
	{
		leftmost[i] = min(a[i], leftmost[i + 1]);
	}

	string ans;
	for (int i = 0; i < k; i++)
	{
		int l, r;
		cin >> l >> r;
		l--, r--;
		int mn = leftmost[l];

		if (mn <= r)
		{
			ans += '1';
		}
		else
		{
			ans += '0';
		}
	}

	cout << ans;
	return 0;
}


#include "iostream"
#include "fstream"
#include "algorithm"
#include "iomanip"
#include "stack"
#include "queue"
#include "string"
#include "vector"
#include "map"
#include "set"
#include "list"
#include "deque"
#include "complex"
#include "bitset"
#include "cmath"
#include "unordered_set"
#include "unordered_map"
#include "iterator"
#include <ctime>
#include <cassert>
#include "numeric"
#include <cstdio>

using namespace std;

//#define f(i,n) for(int i=0; i<n;i++)
//#define rf(i, n) for(int i=n-1;i>=0;i--)
//#define forn(i, j, n) for(int i=j; i<n; i++)
//#define ff(i, j, n) f(i, n)f(j, n)
#define pb push_back
#define maxi(a,b) a = max(a, b);
#define mini(a,b) a = min(a, b);
#define endl '\n'
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define sqr(x) ((x) * (x))
#define SZ(a) ((int)(a.size()))
#define watch(x) cout << (#x) << " = " << x << endl;
//typedef long long ll;
typedef long double ld;
#define int long long
#define double ld
typedef map<int, int> mii;
typedef pair<int, int> pii;
typedef pair<string, int> psi;
typedef pair<int, string> pis;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<pii> vpii;
typedef vector<char> vc;

template<class T>
void show(const vector<T> &a)
{
	for (T x : a)
		cout << x << " ";
	cout << endl;
}

const int sze = 3e5 + 50, oo = 1e18 + 500, mod = 1e9 + 7;
const double eps = 1e-9, PI = 2 * acos(0.0);
vi vertices[sze];
vi visit(sze, 0);
vc used(sze, false);
vi arr(sze, 0);
int n, m, k;
int A, B;
int cnt = 0;

const int N = 1 << 18;
vi t(N << 1, oo);

void build(vi &a)
{
	for (int i = 0; i < m; i++)
	{
		t[i + N] = a[i];
	}

	for (int i = N - 1; i; i--)
	{
		t[i] = min(t[i << 1], t[i << 1 | 1]);
	}
}

int get(int v, int tl, int tr, int l, int r)
{
	if (tl == l && tr == r)
	{
		return t[v];
	}

	int md = (tl + tr) >> 1;
	int ans = oo;
	if (l <= md)
	{
		mini(ans, get(v << 1, tl, md, l, min(r, md)));
	}

	if (r > md)
	{
		mini(ans, get(v << 1 | 1, md+1, tr, max(l, md+1), r));
	}

	return ans;
}

void rec(int i, int c, vi &a)
{
	if (a[i] == oo)
	{
		return;
	}

	if (c <= arr[i])
		return;

	c -= arr[i];

	rec(a[i], c - 1, a);
	a[i] = a[a[i]];
	arr[i] += c;
}

signed main()
{
	ios::sync_with_stdio(0);
	cout.tie(0); cin.tie(0);
	/*freopen("stars.in", "r", stdin);
	freopen("stars.out", "w", stdout);*/

	cin >> n >> m >> k;
	vi p(n), a(m);
	vi nxt(n + 10);

	for (int i = 0; i < n;i++)
	{
		cin >> p[i];
	}

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

	vi ptr(n + 10, 0);

	for (int i = 0; i < m; i++)
	{
		cin >> a[i];
		vertices[a[i]].pb(i);
	}

	for (int i = 0; i < m; i++)
	{
		int v = nxt[a[i]];
		while (ptr[v] < SZ(vertices[v]) && vertices[v][ptr[v]] < i)
		{
			ptr[v] ++;
		}

		if (ptr[v] < SZ(vertices[v]))
		{
			a[i] = vertices[v][ptr[v]];
			//ptr[v]++;
		}
		else
		{
			a[i] = oo;
		}
	}

	//show(a);

	for (int i = 0; i < m; i++)
	{
		//arr.assign(n, n - 2);
		rec(i, n - 2, a);
	}

	//show(a);

	build(a);
	//show(t);
	string ans;
	/*for (int i = 1; i < N; i *= 2)
		cout << t[i] << endl;

	cout << t[N] << endl;
	cout << t[N + 1] << endl;*/
	for (int i = 0; i < k; i++)
	{
		int l, r;
		cin >> l >> r;
		l--, r--;
		int mn = get(1, 0, N - 1, l, r);

		if (mn <= r)
		{
			ans += '1';
		}
		else
		{
			ans += '0';
		}
	}

	cout << ans;
	return 0;
}


#include "iostream"
#include "fstream"
#include "algorithm"
#include "iomanip"
#include "stack"
#include "queue"
#include "string"
#include "vector"
#include "map"
#include "set"
#include "list"
#include "deque"
#include "complex"
#include "bitset"
#include "cmath"
#include "unordered_set"
#include "unordered_map"
#include "iterator"
#include <ctime>
#include <cassert>
#include "numeric"
#include <cstdio>

using namespace std;

//#define f(i,n) for(int i=0; i<n;i++)
//#define rf(i, n) for(int i=n-1;i>=0;i--)
//#define forn(i, j, n) for(int i=j; i<n; i++)
//#define ff(i, j, n) f(i, n)f(j, n)
#define pb push_back
#define maxi(a,b) a = max(a, b);
#define mini(a,b) a = min(a, b);
#define endl '\n'
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define sqr(x) ((x) * (x))
#define SZ(a) ((int)(a.size()))
#define watch(x) cout << (#x) << " = " << x << endl;
//typedef long long ll;
typedef long double ld;
#define int long long
#define double ld
typedef map<int, int> mii;
typedef pair<int, int> pii;
typedef pair<string, int> psi;
typedef pair<int, string> pis;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<pii> vpii;
typedef vector<char> vc;

template<class T>
void show(const vector<T> &a)
{
	for (T x : a)
		cout << x << " ";
	cout << endl;
}

const int sze = 3e5 + 50, oo = 1e18 + 500, mod = 1e9 + 7;
const double eps = 1e-9, PI = 2 * acos(0.0);
vi vertices[sze];
vi visit(sze, 0);
vc used(sze, false);
vi arr(sze, 0);
int n, m, k;
int A, B;
int cnt = 0;

const int N = 1 << 18;
vi t(N << 1, oo);

void build(vi &a)
{
	for (int i = 0; i < m; i++)
	{
		t[i + N] = a[i];
	}

	for (int i = N - 1; i; i--)
	{
		t[i] = min(t[i << 1], t[i << 1 | 1]);
	}
}

int get(int v, int tl, int tr, int l, int r)
{
	if (tl == l && tr == r)
	{
		return t[v];
	}

	int md = (tl + tr) >> 1;
	int ans = oo;
	if (l <= md)
	{
		mini(ans, get(v << 1, tl, md, l, min(r, md)));
	}

	if (r > md)
	{
		mini(ans, get(v << 1 | 1, md+1, tr, max(l, md+1), r));
	}

	return ans;
}

int dp[sze][20];

signed main()
{
	ios::sync_with_stdio(0);
	cout.tie(0); cin.tie(0);
	/*freopen("stars.in", "r", stdin);
	freopen("stars.out", "w", stdout);*/

	cin >> n >> m >> k;
	vi p(n), a(m);
	vi nxt(n + 10);

	for (int i = 0; i < n;i++)
	{
		cin >> p[i];
	}

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

	vi ptr(n + 10, 0);

	for (int i = 0; i < m; i++)
	{
		cin >> a[i];
		vertices[a[i]].pb(i);
	}

	for (int i = 0; i < m; i++)
	{
		int v = nxt[a[i]];
		while (ptr[v] < SZ(vertices[v]) && vertices[v][ptr[v]] < i)
		{
			ptr[v] ++;
		}

		if (ptr[v] < SZ(vertices[v]))
		{
			a[i] = vertices[v][ptr[v]];
			//ptr[v]++;
		}
		else
		{
			a[i] = oo;
		}
	}

	//show(a);

	for (int i =0; i <= m; i++)
	{
		for (int j = 0; j < 20; j++)
		{
			dp[i][j] = oo;
		}
	}

	for (int i = m - 1; i >= 0; i --)
	{
		dp[i][0] = a[i];
		for (int j = 1; j < 20; j++)
		{
			if (dp[i][j - 1] != oo)
				dp[i][j] = dp[dp[i][j - 1]][j - 1];
			else
				break;
		}
	}

	for (int i = 0; i < m; i++)
	{
		int val = n - 2;
		int ind = i;
		for (int j = 19; j >= 0; j--)
		{
			if (1 << j <= val)
			{
				ind = dp[ind][j];
				val -= 1 << j;
				if (ind == oo)
					break;
			}
		}

		if (ind != oo)
			a[i] = a[ind];
		else
			a[i] = oo;
	}

	//show(a);

	build(a);
	//show(t);
	string ans;
	/*for (int i = 1; i < N; i *= 2)
		cout << t[i] << endl;

	cout << t[N] << endl;
	cout << t[N + 1] << endl;*/
	for (int i = 0; i < k; i++)
	{
		int l, r;
		cin >> l >> r;
		l--, r--;
		int mn = get(1, 0, N - 1, l, r);

		if (mn <= r)
		{
			ans += '1';
		}
		else
		{
			ans += '0';
		}
	}

	cout << ans;
	return 0;
}


#include "iostream"
#include "fstream"
#include "algorithm"
#include "iomanip"
#include "stack"
#include "queue"
#include "string"
#include "vector"
#include "map"
#include "set"
#include "list"
#include "deque"
#include "complex"
#include "bitset"
#include "cmath"
#include "unordered_set"
#include "unordered_map"
#include "iterator"
#include <ctime>
#include <cassert>
#include "numeric"
#include <cstdio>

using namespace std;

//#define f(i,n) for(int i=0; i<n;i++)
//#define rf(i, n) for(int i=n-1;i>=0;i--)
//#define forn(i, j, n) for(int i=j; i<n; i++)
//#define ff(i, j, n) f(i, n)f(j, n)
#define pb push_back
#define maxi(a,b) a = max(a, b);
#define mini(a,b) a = min(a, b);
#define endl '\n'
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define sqr(x) ((x) * (x))
#define SZ(a) ((int)(a.size()))
#define watch(x) cout << (#x) << " = " << x << endl;
//typedef long long ll;
typedef long double ld;
#define int long long
#define double ld
typedef map<int, int> mii;
typedef pair<int, int> pii;
typedef pair<string, int> psi;
typedef pair<int, string> pis;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<pii> vpii;
typedef vector<char> vc;

template<class T>
void show(const vector<T> &a)
{
	for (T x : a)
		cout << x << " ";
	cout << endl;
}

const int sze = 3e5 + 50, oo = 1e18 + 500, mod = 1e9 + 7;
const double eps = 1e-9, PI = 2 * acos(0.0);
vi vertices[sze];
vi visit(sze, 0);
vc used(sze, false);
vi arr(sze, 0);
int n, m, k;
int A, B;
int cnt = 0;

const int N = 1 << 18;
vi t(N << 1, oo);

void build(vi &a)
{
	for (int i = 0; i < m; i++)
	{
		t[i + N] = a[i];
	}

	for (int i = N - 1; i; i--)
	{
		t[i] = min(t[i << 1], t[i << 1 | 1]);
	}
}

int get(int v, int tl, int tr, int l, int r)
{
	if (tl == l && tr == r)
	{
		return t[v];
	}

	int md = (tl + tr) >> 1;
	int ans = oo;
	if (l <= md)
	{
		mini(ans, get(v << 1, tl, md, l, min(r, md)));
	}

	if (r > md)
	{
		mini(ans, get(v << 1 | 1, md+1, tr, max(l, md+1), r));
	}

	return ans;
}

int dp[sze][20];

signed main()
{
	ios::sync_with_stdio(0);
	cout.tie(0); cin.tie(0);
	/*freopen("stars.in", "r", stdin);
	freopen("stars.out", "w", stdout);*/

	cin >> n >> m >> k;
	vi p(n), a(m);
	vi nxt(n + 10);

	for (int i = 0; i < n;i++)
	{
		cin >> p[i];
	}

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

	vi ptr(n + 10, 0);

	for (int i = 0; i < m; i++)
	{
		cin >> a[i];
		vertices[a[i]].pb(i);
	}

	for (int i = 0; i < m; i++)
	{
		int v = nxt[a[i]];
		while (ptr[v] < SZ(vertices[v]) && vertices[v][ptr[v]] < i)
		{
			ptr[v] ++;
		}

		if (ptr[v] < SZ(vertices[v]))
		{
			a[i] = vertices[v][ptr[v]];
			//ptr[v]++;
		}
		else
		{
			a[i] = oo;
		}
	}

	//show(a);

	for (int i = m - 1; i >= 0; i --)
	{
		dp[i][0] = a[i];
		for (int j = 1; j < 20; j++)
		{
			if(dp[i][j-1] != oo)
				dp[i][j] = dp[dp[i][j-1]][j - 1];
			else
			{
				dp[i][j] = oo;
				break;
			}
		}
	}

	for (int i = 0; i < m; i++)
	{
		int val = n - 2;
		int ind = i;
		for (int j = 19; j >= 0; j--)
		{
			if (1 << j <= val)
			{
				ind = dp[ind][j];
				val -= 1 << j;
				if (ind == oo)
					break;
			}
		}

		if (ind != oo)
			a[i] = a[ind];
		else
			a[i] = oo;
	}

	//show(a);

	build(a);
	//show(t);
	string ans;
	/*for (int i = 1; i < N; i *= 2)
		cout << t[i] << endl;

	cout << t[N] << endl;
	cout << t[N + 1] << endl;*/
	for (int i = 0; i < k; i++)
	{
		int l, r;
		cin >> l >> r;
		l--, r--;
		int mn = get(1, 0, N - 1, l, r);

		if (mn <= r)
		{
			ans += '1';
		}
		else
		{
			ans += '0';
		}
	}

	cout << ans;
	return 0;
}


#include "iostream"
#include "fstream"
#include "algorithm"
#include "iomanip"
#include "stack"
#include "queue"
#include "string"
#include "vector"
#include "map"
#include "set"
#include "list"
#include "deque"
#include "complex"
#include "bitset"
#include "cmath"
#include "unordered_set"
#include "unordered_map"
#include "iterator"
#include <ctime>
#include <cassert>
#include "numeric"
#include <cstdio>

using namespace std;

//#define f(i,n) for(int i=0; i<n;i++)
//#define rf(i, n) for(int i=n-1;i>=0;i--)
//#define forn(i, j, n) for(int i=j; i<n; i++)
//#define ff(i, j, n) f(i, n)f(j, n)
#define pb push_back
#define maxi(a,b) a = max(a, b);
#define mini(a,b) a = min(a, b);
#define endl '\n'
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define sqr(x) ((x) * (x))
#define SZ(a) ((int)(a.size()))
#define watch(x) cout << (#x) << " = " << x << endl;
//typedef long long ll;
typedef long double ld;
#define int long long
#define double ld
typedef map<int, int> mii;
typedef pair<int, int> pii;
typedef pair<string, int> psi;
typedef pair<int, string> pis;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<pii> vpii;
typedef vector<char> vc;

template<class T>
void show(const vector<T> &a)
{
	for (T x : a)
		cout << x << " ";
	cout << endl;
}

const int sze = 3e5 + 50, oo = 1e18 + 500, mod = 1e9 + 7;
const double eps = 1e-9, PI = 2 * acos(0.0);
vi vertices[sze];
vi visit(sze, 0);
vc used(sze, false);
vi arr(sze, 0);
int n, m, k;
int A, B;
int cnt = 0;

const int N = 1 << 18;
vi t(N << 1, oo);

void build(vi &a)
{
	for (int i = 0; i < m; i++)
	{
		t[i + N] = a[i];
	}

	for (int i = N - 1; i; i--)
	{
		t[i] = min(t[i << 1], t[i << 1 | 1]);
	}
}

int get(int v, int tl, int tr, int l, int r)
{
	if (tl == l && tr == r)
	{
		return t[v];
	}

	int md = (tl + tr) >> 1;
	int ans = oo;
	if (l <= md)
	{
		mini(ans, get(v << 1, tl, md, l, min(r, md)));
	}

	if (r > md)
	{
		mini(ans, get(v << 1 | 1, md+1, tr, max(l, md+1), r));
	}

	return ans;
}

signed main()
{
	ios::sync_with_stdio(0);
	cout.tie(0); cin.tie(0);
	/*freopen("stars.in", "r", stdin);
	freopen("stars.out", "w", stdout);*/

	cin >> n >> m >> k;
	vi p(n), a(m);
	vi nxt(n + 10);

	for (int i = 0; i < n;i++)
	{
		cin >> p[i];
	}

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

	vi ptr(n + 10, 0);

	for (int i = 0; i < m; i++)
	{
		cin >> a[i];
		vertices[a[i]].pb(i);
	}

	for (int i = 0; i < m; i++)
	{
		int v = nxt[a[i]];
		while (ptr[v] < SZ(vertices[v]) && vertices[v][ptr[v]] < i)
		{
			ptr[v] ++;
		}

		if (ptr[v] < SZ(vertices[v]))
		{
			a[i] = vertices[v][ptr[v]];
			//ptr[v]++;
		}
		else
		{
			a[i] = oo;
		}
	}

	//show(a);

	for (int i = 0; i < m; i++)
	{
		cnt = 0;
		while (a[i] != oo && cnt < n - 2)
		{
			a[i] = a[a[i]];
			cnt++;
		}
	}

	//show(a);

	build(a);
	//show(t);
	string ans;
	/*for (int i = 1; i < N; i *= 2)
		cout << t[i] << endl;

	cout << t[N] << endl;
	cout << t[N + 1] << endl;*/
	for (int i = 0; i < k; i++)
	{
		int l, r;
		cin >> l >> r;
		l--, r--;
		int mn = get(1, 0, N - 1, l, r);

		if (mn <= r)
		{
			ans += '1';
		}
		else
		{
			ans += '0';
		}
	}

	cout << ans;
	return 0;
}


#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <functional>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <stack>
#include <utility>
using namespace std;

typedef long long ll;

const int INF = 0x3f3f3f3f;

vector<int> nidx[200001];
int N, M, Q, p[200001], a[200001], tree[1 << 19], NN, nxt[200001][19], pidx[200001];
char ans[200001];

int range_min(int ql, int qr, int l = 1, int r = NN, int idx = 1){
	if(ql <= l && r <= qr) return tree[idx];
	if(r < ql || qr < l) return INF;
	return min(range_min(ql, qr, l, (l + r) / 2, idx * 2),
			   range_min(ql, qr, (l + r) / 2 + 1, r, idx * 2 + 1));
}

int find_idx(int S, vector<int> &is){
	int l = 0, r = is.size() - 1, m, ret = -1;
	while(l <= r){
		m = (l + r) / 2;
		if(is[m] <= S) l = m + 1;
		else ret = is[m], r = m - 1;
	}
	return ret;
}

bool psb(int l, int r){
	if(r - l + 1 < N) return false;
	return range_min(l, r) <= r;
}

int main()
{
	scanf("%d %d %d", &N, &M, &Q);
	for(int i = 1; i <= N; i++){
		scanf("%d", &p[i]);
		pidx[p[i]] = i;
	}
	for(int i = 1; i <= M; i++){
		scanf("%d", &a[i]);
		nidx[a[i]].push_back(i);
	}

	memset(tree, 0x3f, sizeof(tree));
	memset(nxt, 0xff, sizeof(nxt));
	for(NN = 1; NN < M; NN <<= 1);
	for(int i = 1; i <= M; i++)
		nxt[i][0] = find_idx(i, nidx[p[(pidx[a[i]] % N) + 1]]);
	for(int i = 1; i < 19; i++)
		for(int j = 1; j <= M; j++){
			if(nxt[j][i - 1] < 0) continue;
			nxt[j][i] = nxt[nxt[j][i - 1]][i - 1];
		}

	// for(int i = 1; i <= M; i++){
	// 	printf("[*] %d - ", a[i]);
	// 	for(int j = 0; j < 19; j++){
	// 		printf("%d:%d ", 1 << j, nxt[i][j]);
	// 		if(nxt[i][j] < 0) break;
	// 	}
	// 	printf("\n");
	// }

	for(int i = 1; i <= M; i++){
		int cur = i, ex = 0, copy;
		for(copy = N - 1; copy && cur > 0; copy >>= 1, ex++){
			if(copy & 1){
				cur = nxt[cur][ex];
				ex = -1;
			}
		}
		// printf("%d: %d\n", i, cur);
		if(cur < 0 || copy) continue;
		tree[NN + i - 1] = cur;
	}

	for(int i = NN - 1; i > 0; i--)
		tree[i] = min(tree[i * 2], tree[i * 2 + 1]);

	for(int i = 0, l, r; i < Q; i++){
		scanf("%d %d", &l, &r);
		ans[i] = '0' + psb(l, r);
	}
	printf("%s\n", ans);

	return 0;
}


#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <functional>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <stack>
#include <utility>
using namespace std;

typedef long long ll;

const int INF = 0x3f3f3f3f;

vector<int> nidx[200001];
int N, M, Q, p[200001], a[200001], tree[1 << 19], NN, nxt[200001][19], pidx[200001];
char ans[200001];

int range_min(int ql, int qr, int l = 1, int r = NN, int idx = 1){
	if(ql <= l && r <= qr) return tree[idx];
	if(r < ql || qr < l) return INF;
	return min(range_min(ql, qr, l, (l + r) / 2, idx * 2),
			   range_min(ql, qr, (l + r) / 2 + 1, r, idx * 2 + 1));
}

int find_idx(int S, vector<int> &is){
	int l = 0, r = is.size() - 1, m, ret = -1;
	while(l <= r){
		m = (l + r) / 2;
		if(is[m] <= S) l = m + 1;
		else ret = is[m], r = m - 1;
	}
	return ret;
}

bool psb(int l, int r){
	if(r - l + 1 < N) return false;
	return range_min(l, r) <= r;
}

int main()
{
	scanf("%d %d %d", &N, &M, &Q);
	for(int i = 1; i <= N; i++){
		scanf("%d", &p[i]);
		pidx[p[i]] = i;
	}
	for(int i = 1; i <= M; i++){
		scanf("%d", &a[i]);
		nidx[a[i]].push_back(i);
	}

	memset(tree, 0x3f, sizeof(tree));
	memset(nxt, 0xff, sizeof(nxt));
	for(NN = 1; NN < M; NN <<= 1);
	for(int i = 1; i <= M; i++)
		nxt[i][0] = find_idx(i, nidx[p[(pidx[a[i]] % N) + 1]]);
	for(int i = 1; i < 19; i++)
		for(int j = 1; j <= M; j++){
			if(nxt[j][i - 1] < 0) continue;
			nxt[j][i] = nxt[nxt[j][i - 1]][i - 1];
		}

	for(int i = 1; i <= M; i++){
		int cur = i, ex = 0, copy = N - 1;
		for(int i = 18, b = 1 << 18; i >= 0; i--, b >>= 1)
			if(copy & b) cur = nxt[cur][i];
		if(cur < 0) continue;
		tree[NN + i - 1] = cur;
	}

	for(int i = NN - 1; i > 0; i--)
		tree[i] = min(tree[i * 2], tree[i * 2 + 1]);

	for(int i = 0, l, r; i < Q; i++){
		scanf("%d %d", &l, &r);
		ans[i] = '0' + psb(l, r);
	}
	printf("%s\n", ans);

	return 0;
}


#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <functional>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <stack>
#include <utility>
using namespace std;

typedef long long ll;

const int INF = 0x3f3f3f3f;

vector<int> nidx[200001];
int N, M, Q, p[200001], a[200001], tree[1 << 19], NN, nxt[200001][19], pidx[200001];
char ans[200001];

int range_min(int ql, int qr, int l = 1, int r = NN, int idx = 1){
	if(ql <= l && r <= qr) return tree[idx];
	if(r < ql || qr < l) return INF;
	return min(range_min(ql, qr, l, (l + r) / 2, idx * 2),
			   range_min(ql, qr, (l + r) / 2 + 1, r, idx * 2 + 1));
}

int find_idx(int S, vector<int> &is){
	int l = 0, r = is.size() - 1, m, ret = -1;
	while(l <= r){
		m = (l + r) / 2;
		if(is[m] <= S) l = m + 1;
		else ret = is[m], r = m - 1;
	}
	return ret;
}

bool psb(int l, int r){
	if(r - l + 1 < N) return false;
	return range_min(l, r) <= r;
}

int main()
{
	scanf("%d %d %d", &N, &M, &Q);
	for(int i = 1; i <= N; i++){
		scanf("%d", &p[i]);
		pidx[p[i]] = i;
	}
	for(int i = 1; i <= M; i++){
		scanf("%d", &a[i]);
		nidx[a[i]].push_back(i);
	}

	memset(tree, 0x3f, sizeof(tree));
	memset(nxt, 0xff, sizeof(nxt));
	for(NN = 1; NN < M; NN <<= 1);
	for(int i = 1; i <= M; i++)
		nxt[i][0] = find_idx(i, nidx[p[(pidx[a[i]] % N) + 1]]);
	for(int i = 1; i < 19; i++)
		for(int j = 1; j <= M; j++){
			if(nxt[j][i - 1] < 0) continue;
			nxt[j][i] = nxt[nxt[j][i - 1]][i - 1];
		}

	for(int i = 1; i <= M; i++){
		int cur = i, ex = 0, copy = N - 1;
		for(int j = 18, b = 1 << 18; j >= 0; j--, b >>= 1)
			if(copy & b) cur = nxt[cur][j];
		if(cur < 0) continue;
		tree[NN + i - 1] = cur;
	}

	for(int i = NN - 1; i > 0; i--)
		tree[i] = min(tree[i * 2], tree[i * 2 + 1]);

	for(int i = 0, l, r; i < Q; i++){
		scanf("%d %d", &l, &r);
		ans[i] = '0' + psb(l, r);
	}
	printf("%s\n", ans);

	return 0;
}


#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <functional>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <stack>
#include <utility>
using namespace std;

typedef long long ll;

const int INF = 0x3f3f3f3f;

vector<int> nidx[200001];
int N, M, Q, p[200001], a[200001], tree[1 << 19], NN, nxt[200001][19], pidx[200001];
char ans[200001];

int range_min(int ql, int qr, int l = 1, int r = NN, int idx = 1){
	if(ql <= l && r <= qr) return tree[idx];
	if(r < ql || qr < l) return INF;
	return min(range_min(ql, qr, l, (l + r) / 2, idx * 2),
			   range_min(ql, qr, (l + r) / 2 + 1, r, idx * 2 + 1));
}

int find_idx(int S, vector<int> &is){
	int l = 0, r = is.size() - 1, m, ret = -1;
	while(l <= r){
		m = (l + r) / 2;
		if(is[m] <= S) l = m + 1;
		else ret = is[m], r = m - 1;
	}
	return ret;
}

bool psb(int l, int r){
	if(r - l + 1 < N) return false;
	return range_min(l, r) <= r;
}

int main()
{
	scanf("%d %d %d", &N, &M, &Q);
	for(int i = 1; i <= N; i++){
		scanf("%d", &p[i]);
		pidx[p[i]] = i;
	}
	for(int i = 1; i <= M; i++){
		scanf("%d", &a[i]);
		nidx[a[i]].push_back(i);
	}

	memset(tree, 0x3f, sizeof(tree));
	memset(nxt, 0xff, sizeof(nxt));
	for(NN = 1; NN < M; NN <<= 1);
	for(int i = 1; i <= M; i++)
		nxt[i][0] = find_idx(i, nidx[p[(pidx[a[i]] % N) + 1]]);
	for(int i = 1; i < 19; i++)
		for(int j = 1; j <= M; j++){
			if(nxt[j][i - 1] < 0) continue;
			nxt[j][i] = nxt[nxt[j][i - 1]][i - 1];
		}

	for(int i = 1; i <= M; i++){
		int cur = i, copy = N - 1;
		for(int j = 0; copy && cur > 0; j++, copy >>= 1)
			if(copy & 1) cur = nxt[cur][j];
		if(cur < 0) continue;
		tree[NN + i - 1] = cur;
	}

	for(int i = NN - 1; i > 0; i--)
		tree[i] = min(tree[i * 2], tree[i * 2 + 1]);

	for(int i = 0, l, r; i < Q; i++){
		scanf("%d %d", &l, &r);
		ans[i] = '0' + psb(l, r);
	}
	printf("%s\n", ans);

	return 0;
}


#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <functional>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <stack>
#include <utility>
using namespace std;

typedef long long ll;

const int INF = 0x3f3f3f3f;

vector<int> nidx[200001];
int N, M, Q, p[200001], a[200001], tree[1 << 19], NN, nxt[200001][19], pidx[200001];
char ans[200001];

int range_min(int ql, int qr, int l = 1, int r = NN, int idx = 1){
	if(ql <= l && r <= qr) return tree[idx];
	if(r < ql || qr < l) return INF;
	return min(range_min(ql, qr, l, (l + r) / 2, idx * 2),
			   range_min(ql, qr, (l + r) / 2 + 1, r, idx * 2 + 1));
}

int find_idx(int S, vector<int> &is){
	int l = 0, r = is.size() - 1, m, ret = -1;
	while(l <= r){
		m = (l + r) / 2;
		if(is[m] < S) l = m + 1;
		else ret = is[m], r = m - 1;
	}
	return ret;
}

bool psb(int l, int r){
	if(r - l + 1 < N) return false;
	return range_min(l, r) <= r;
}

int main()
{
	scanf("%d %d %d", &N, &M, &Q);
	for(int i = 1; i <= N; i++){
		scanf("%d", &p[i]);
		pidx[p[i]] = i;
	}
	for(int i = 1; i <= M; i++){
		scanf("%d", &a[i]);
		nidx[a[i]].push_back(i);
	}
	for(int i = 1; i <= N; i++)
		sort(nidx[i].begin(), nidx[i].end());

	memset(tree, 0x3f, sizeof(tree));
	memset(nxt, 0xff, sizeof(nxt));
	for(NN = 1; NN < M; NN <<= 1);
	for(int i = 1; i <= M; i++){
		// printf("%d %d %d\n", i, a[i], p[(pidx[a[i]] % N) + 1]);
		nxt[i][0] = find_idx(i, nidx[p[(pidx[a[i]] % N) + 1]]);
	}
	for(int i = 1; i < 19; i++)
		for(int j = 1; j <= M; j++){
			if(nxt[j][i - 1] < 0) continue;
			nxt[j][i] = nxt[nxt[j][i - 1]][i - 1];
		}

	// for(int i = 1; i <= M; i++){
	// 	printf("[*] %d - ", a[i]);
	// 	for(int j = 0; j < 19; j++){
	// 		printf("%d:%d ", 1 << j, nxt[i][j]);
	// 		if(nxt[i][j] < 0) break;
	// 	}
	// 	printf("\n");
	// }

	for(int i = 1; i <= M; i++){
		int cur = i, ex = 0;
		for(int copy = N - 1; copy && cur > 0; copy >>= 1, ex++){
			if(copy & 1){
				cur = nxt[cur][ex];
				ex = -1;
			}
		}
		if(cur < 0) continue;
		tree[NN + i - 1] = cur;
	}

	for(int i = NN - 1; i > 0; i--)
		tree[i] = min(tree[i * 2], tree[i * 2 + 1]);

	for(int i = 0, l, r; i < Q; i++){
		scanf("%d %d", &l, &r);
		ans[i] = '0' + psb(l, r);
	}
	printf("%s\n", ans);

	return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <cmath>
#include <intrin.h>
using namespace std;

class segments
{
public:
    segments(vector<int>& v) : t(4 * v.size())
    {
        build(v, 1, 0, v.size() - 1);
    }
    int rmq(int v, int tl, int tr, int l, int r)
    {
        if (l > r)
            return -1;
        if (tl == l && tr == r)
            return t[v];
        int tm = (tl + tr) / 2;
        return max
        (
            rmq(2 * v, tl, tm, l, min(r, tm)),
            rmq(2 * v + 1, tm + 1, tr, max(tm + 1, l), r)
        );
    }
private:
    int build(vector<int>& a, int v, int tl, int tr)
    {
        if (tl == tr)
            return t[v] = a[tr];
        int tm = (tl + tr) / 2;
        return t[v] = max(build(a, 2 * v, tl, tm), build(a, 2 * v + 1, tm + 1, tr));
    }
private:
    vector<int> t;
};

struct Solution
{
    void RunTest(size_t test_id)
    {
        int n, m, q;
        cin >> n >> m >> q;
        vector<int> p(n+1);
        vector<int> v(m+1);
        vector<int> w(n + 1);
        vector<int> h(n + 1, -1);
        for (int i = 0; i < n; ++i)
        {
            cin >> p[i];
            w[p[i]] = i;
        }
        for (int i = 0; i < m; ++i)
        {
            cin >> v[i];
        }
        int len = 0;
        int last = 0;
        vector<int> u(m + 1);
        vector<int> first(m + 1, -1);
        for (int i = 0; i <= m; ++i)
        {
            first[i] = i;
        }
        vector<int> next(m + 1, -1);
        vector<int> ref(m + 1, -1);
        for (int i = 0; i < m; ++i)
        {
            int prev = p[(w[v[i]] - 1 + 2 * n) % n];
            if (prev < h.size() && (h[prev] != -1))
            {
                prev = h[prev];
                if (prev < 0 || prev >= m)
                    while (true);
                if (u[prev] + 1 <= n)
                    first[i] = first[prev];
                else
                {
                    first[i] = next[first[prev]];
                }
                u[i] = min(n, u[prev] + 1);
                next[prev] = i;
            }
            else
            {
                u[i] = 1;
                first[i] = i;
                next[i] = i;
            }
            h[v[i]] = i;
            if (u[i] == n)
                ref[i] = first[i];
        }
        segments seg(ref);
        string ans;
        for (int i = 0; i < q; ++i)
        {
            int l, r;
            cin >> l >> r;
            --l, --r;
            char f = '0';
            if (seg.rmq(1, 0, ref.size() - 1, l, r) >= l)
                f = '1';
            ans += f;
        }
        cout << ans << endl;
    }
};

int main()
{
    std::ios_base::sync_with_stdio(false);
    size_t test_count = 1;
#if 0
    cin >> test_count;
#endif
    for (size_t i = 0; i < test_count; ++i)
    {
        Solution().RunTest(i);
    }
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <cmath>
#include <intrin.h>
using namespace std;

class segments
{
public:
    segments(vector<int>& v) : t(4 * v.size())
    {
        build(v, 1, 0, v.size() - 1);
    }
    int rmq(int v, int tl, int tr, int l, int r)
    {
        if (l > r)
            return -1;
        if (tl == l && tr == r)
            return t[v];
        int tm = (tl + tr) / 2;
        return max
        (
            rmq(2 * v, tl, tm, l, min(r, tm)),
            rmq(2 * v + 1, tm + 1, tr, max(tm + 1, l), r)
        );
    }
private:
    int build(vector<int>& a, int v, int tl, int tr)
    {
        if (tl == tr)
            return t[v] = a[tr];
        int tm = (tl + tr) / 2;
        return t[v] = max(build(a, 2 * v, tl, tm), build(a, 2 * v + 1, tm + 1, tr));
    }
private:
    vector<int> t;
};

struct Solution
{
    void RunTest(size_t test_id)
    {
        int n, m, q;
        cin >> n >> m >> q;
        vector<int> p(n+1);
        vector<int> v(m+1);
        vector<int> w(n + 1);
        vector<int> h(n + 1, -1);
        for (int i = 0; i < n; ++i)
        {
            cin >> p[i];
            w[p[i]] = i;
        }
        for (int i = 0; i < m; ++i)
        {
            cin >> v[i];
        }
        int len = 0;
        int last = 0;
        vector<int> u(m + 1);
        vector<int> first(m + 1, -1);
        for (int i = 0; i <= m; ++i)
        {
            first[i] = i;
        }
        vector<int> next(m + 1, -1);
        vector<int> ref(m + 1, -1);
        for (int i = 0; i < m; ++i)
        {
            int prev_val = p[(w[v[i]] - 1 + n) % n];
            if (prev_val < h.size() && (h[prev_val] != -1))
            {
                int prev = h[prev_val];
                if (u[prev] + 1 <= n)
                    first[i] = first[prev];
                else
                {
                    first[i] = next[first[prev]];
                }
                u[i] = min(n, u[prev] + 1);
                if (next[prev] == -1)
                    next[prev] = i;
            }
            else
            {
                u[i] = 1;
                first[i] = i;
            }
            h[v[i]] = i;
            if (u[i] == n)
                ref[i] = first[i];
        }
        segments seg(ref);
        string ans;
        for (int i = 0; i < q; ++i)
        {
            int l, r;
            cin >> l >> r;
            --l, --r;
            char f = '0';
            if (seg.rmq(1, 0, ref.size() - 1, l, r) >= l)
                f = '1';
            ans += f;
        }
        cout << ans << endl;
    }
};

int main()
{
    std::ios_base::sync_with_stdio(false);
    size_t test_count = 1;
#if 0
    cin >> test_count;
#endif
    for (size_t i = 0; i < test_count; ++i)
    {
        Solution().RunTest(i);
    }
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <cmath>
#include <intrin.h>
using namespace std;

struct tree
{
    vector<int64_t> t;
    int n;

    tree(vector<int64_t> & a)
        : n(a.size())
        , t(2 * a.size())
    {
        for (int i = 0; i < n; ++i)
            t[n + i] = a[i];
        for (int i = n - 1; i >= 0; --i)
            t[i] = max(t[i << 1], t[i << 1 | 1]);
    }

    int64_t query(int l, int r)
    {
        int64_t res = -1;
        for (l += n, r += n; l < r; l >>= 1, r >>= 1)
        {
            if (l & 1)
                res = max(res, t[l++]);
            if (r & 1)
                res = max(res, t[--r]);
        }
        return res;
    }
};

struct Solution
{
    void RunTest(size_t test_id)
    {
        int n, m, q;
        cin >> n >> m >> q;
        vector<int> p(n);
        vector<int> v(m);
        vector<int> w(n + 1);
        vector<int> h(n + 1, -1);
        for (int i = 0; i < n; ++i)
        {
            cin >> p[i];
            w[p[i]] = i;
        }
        for (int i = 0; i < m; ++i)
        {
            cin >> v[i];
        }
        int len = 0;
        int last = 0;
        vector<int> u(m);
        vector<int> first(m, -1);
        for (int i = 0; i < m; ++i)
        {
            first[i] = i;
        }
        vector<int> next(m, -1);
        vector<int64_t> ref(m, -1);
        for (int i = 0; i < m; ++i)
        {
            int prev = p[(w[v[i]] - 1 + n) % n];
            if (h[prev] != -1)
            {
                prev = h[prev];
                if (u[prev] + 1 <= n)
                    first[i] = first[prev];
                else
                    first[i] = next[first[prev]];
                u[i] = min(n, u[prev] + 1);
                next[prev] = i;
            }
            else
            {
                u[i] = 1;
                first[i] = i;
            }
            h[v[i]] = i;
            if (u[i] == n)
                ref[i] = first[i];
        }
        tree seg(ref);
        string ans;
        for (int i = 0; i < q; ++i)
        {
            int l, r;
            cin >> l >> r;
            --l, --r;
            char f = '0';
            if (seg.query(l, r + 1) >= l)
                f = '1';
            ans += f;
        }
        cout << ans << endl;
    }
};

int main()
{
    std::ios_base::sync_with_stdio(false);
    size_t test_count = 1;
#if 0
    cin >> test_count;
#endif
    for (size_t i = 0; i < test_count; ++i)
    {
        Solution().RunTest(i);
    }
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <cmath>
#include <intrin.h>
using namespace std;

struct tree
{
    vector<int64_t> t;
    int n;

    tree(vector<int64_t> & a)
        : n(a.size())
        , t(2 * a.size())
    {
        for (int i = 0; i < n; ++i)
            t[n + i] = a[i];
        for (int i = n - 1; i >= 0; --i)
            t[i] = max(t[i << 1], t[i << 1 | 1]);
    }

    int64_t query(int l, int r)
    {
        int64_t res = -1;
        l = max(l, 0);
        if (l >= r)
            return -1;
        for (l += n, r += n; l < r; l >>= 1, r >>= 1)
        {
            if (l & 1)
                res = max(res, t[l++]);
            if (r & 1)
                res = max(res, t[--r]);
        }
        return res;
    }
};

struct Solution
{
    void RunTest(size_t test_id)
    {
        int n, m, q;
        cin >> n >> m >> q;
        vector<int> p(n);
        vector<int> v(m);
        vector<int> w(n + 1);
        vector<int> h(n + 1, -1);
        for (int i = 0; i < n; ++i)
        {
            cin >> p[i];
            w[p[i]] = i;
        }
        for (int i = 0; i < m; ++i)
        {
            cin >> v[i];
        }
        int len = 0;
        int last = 0;
        vector<int> u(m + 1);
        vector<int> first(m + 1, -1);
        for (int i = 0; i < m; ++i)
        {
            first[i] = i;
        }
        vector<int> next(m + 1, -1);
        vector<int64_t> ref(m + 1, -1);
        for (int i = 0; i < m; ++i)
        {
            int prev = p[(w[v[i]] - 1 + 2 * n) % n];
            if (prev < h.size() && (h[prev] != -1))
            {
                prev = h[prev];
                if (prev < 0 || prev >= m)
                    while (true);
                if (u[prev] + 1 <= n)
                    first[i] = first[prev];
                else
                {
                    first[i] = next[first[prev]];
                }
                u[i] = min(n, u[prev] + 1);
                next[prev] = i;
            }
            else
            {
                u[i] = 1;
                first[i] = i;
            }
            h[v[i]] = i;
            if (u[i] == n)
                ref[i] = first[i];
        }
        tree seg(ref);
        string ans;
        for (int i = 0; i < q; ++i)
        {
            int l, r;
            cin >> l >> r;
            --l, --r;
            char f = '0';
            if (seg.query(l, r + 1) >= l)
                f = '1';
            ans += f;
        }
        cout << ans << endl;
    }
};

int main()
{
    std::ios_base::sync_with_stdio(false);
    size_t test_count = 1;
#if 0
    cin >> test_count;
#endif
    for (size_t i = 0; i < test_count; ++i)
    {
        Solution().RunTest(i);
    }
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <cmath>
#include <intrin.h>
using namespace std;

struct tree
{
    vector<int64_t> t;
    int n;

    tree(vector<int64_t> & a)
        : n(a.size())
        , t(2 * a.size())
    {
        for (int i = 0; i < n; ++i)
            t[n + i] = a[i];
        for (int i = n - 1; i >= 0; --i)
            t[i] = max(t[i << 1], t[i << 1 | 1]);
    }

    int64_t query(int l, int r)
    {
        int64_t res = -1;
        for (l += n, r += n; l < r; l >>= 1, r >>= 1)
        {
            if (l & 1)
                res = max(res, t[l++]);
            if (r & 1)
                res = max(res, t[--r]);
        }
        return res;
    }
};

struct Solution
{
    void RunTest(size_t test_id)
    {
        int n, m, q;
        cin >> n >> m >> q;
        vector<int> p(n);
        vector<int> v(m);
        vector<int> w(n + 1);
        vector<int> h(n + 1, -1);
        for (int i = 0; i < n; ++i)
        {
            cin >> p[i];
            w[p[i]] = i;
        }
        for (int i = 0; i < m; ++i)
        {
            cin >> v[i];
        }
        int len = 0;
        int last = 0;
        vector<int> u(m);
        vector<int> first(m, -1);
        vector<int> next(m, -1);
        vector<int> pp(m, - 1);
        vector<int64_t> ref(m, -1);
        for (int i = 0; i < m; ++i)
        {
            int prev = p[(w[v[i]] - 1 + n) % n];
            if (h[prev] != -1)
            {
                pp[i] = prev;
                prev = h[prev];
                if (u[prev] + 1 <= n)
                    first[i] = first[prev];
                else
                    first[i] = next[first[prev]];
                u[i] = min(n, u[prev] + 1);
                next[prev] = i;
            }
            else
            {
                u[i] = 1;
                first[i] = i;
            }
            h[v[i]] = i;
            if (u[i] == n)
            {
                ref[i] = first[i];
            }
        }
        tree seg(ref);
        string ans;
        for (int i = 0; i < q; ++i)
        {
            int l, r;
            cin >> l >> r;
            --l, --r;
            char f = '0';
            if (seg.query(l, r + 1) >= l)
                f = '1';
            ans += f;
        }
        cout << ans << endl;
    }
};

int main()
{
    std::ios_base::sync_with_stdio(false);
    size_t test_count = 1;
#if 0
    cin >> test_count;
#endif
    for (size_t i = 0; i < test_count; ++i)
    {
        Solution().RunTest(i);
    }
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <cmath>
#include <intrin.h>
using namespace std;

class segments
{
public:
    segments(vector<int>& v) : t(4 * v.size())
    {
        build(v, 1, 0, v.size() - 1);
    }
    int rmq(int v, int tl, int tr, int l, int r)
    {
        if (l > r)
            return -1;
        if (tl == l && tr == r)
            return t[v];
        int tm = (tl + tr) / 2;
        return max
        (
            rmq(2 * v, tl, tm, l, min(r, tm)),
            rmq(2 * v + 1, tm + 1, tr, max(tm + 1, l), r)
        );
    }
private:
    int build(vector<int>& a, int v, int tl, int tr)
    {
        if (tl == tr)
            return t[v] = a[tr];
        int tm = (tl + tr) / 2;
        return t[v] = max(build(a, 2 * v, tl, tm), build(a, 2 * v + 1, tm + 1, tr));
    }
private:
    vector<int> t;
};

struct Solution
{
    void RunTest(size_t test_id)
    {
        int n, m, q;
        cin >> n >> m >> q;
        vector<int> p(n+1);
        vector<int> v(m+1);
        vector<int> w(n + 1);
        vector<int> h(n + 1, -1);
        for (int i = 0; i < n; ++i)
        {
            cin >> p[i];
            w[p[i]] = i;
        }
        for (int i = 0; i < m; ++i)
        {
            cin >> v[i];
        }
        int len = 0;
        int last = 0;
        vector<int> u(m + 1);
        vector<int> first(m + 1, -1);
        for (int i = 0; i <= m; ++i)
        {
            first[i] = i;
        }
        vector<int> next(m + 1, -1);
        vector<int> ref(m + 1, -1);
        for (int i = 0; i < m; ++i)
        {
            int prev = p[(w[v[i]] - 1 + 2 * n) % n];
            if (prev < h.size() && (h[prev] != -1))
            {
                prev = h[prev];
                if (prev < 0 || prev >= m)
                    while (true);
                if (u[prev] + 1 <= n)
                    first[i] = first[prev];
                else
                {
                    first[i] = next[first[prev]];
                }
                u[i] = min(n, u[prev] + 1);
                next[prev] = i;
                next[i] = i;
            }
            else
            {
                u[i] = 1;
                first[i] = i;
                next[i] = i;
            }
            h[v[i]] = i;
            if (u[i] == n)
                ref[i] = first[i];
        }
        segments seg(ref);
        string ans;
        for (int i = 0; i < q; ++i)
        {
            int l, r;
            cin >> l >> r;
            --l, --r;
            char f = '0';
            if (seg.rmq(1, 0, ref.size() - 1, l, r) >= l)
                f = '1';
            ans += f;
        }
        cout << ans << endl;
    }
};

int main()
{
    std::ios_base::sync_with_stdio(false);
    size_t test_count = 1;
#if 0
    cin >> test_count;
#endif
    for (size_t i = 0; i < test_count; ++i)
    {
        Solution().RunTest(i);
    }
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <cmath>
#include <intrin.h>
using namespace std;

class segments
{
public:
    segments(vector<int>& v) : t(4 * v.size())
    {
        build(v, 1, 0, v.size() - 1);
    }
    int rmq(int v, int tl, int tr, int l, int r)
    {
        if (l > r)
            return -1;
        if (tl == l && tr == r)
            return t[v];
        int tm = (tl + tr) / 2;
        return max
        (
            rmq(2 * v, tl, tm, l, min(r, tm)),
            rmq(2 * v + 1, tm + 1, tr, max(tm + 1, l), r)
        );
    }
private:
    int build(vector<int>& a, int v, int tl, int tr)
    {
        if (tl == tr)
            return t[v] = a[tr];
        int tm = (tl + tr) / 2;
        return t[v] = max(build(a, 2 * v, tl, tm), build(a, 2 * v + 1, tm + 1, tr));
    }
private:
    vector<int> t;
};

struct Solution
{
    void RunTest(size_t test_id)
    {
        int n, m, q;
        cin >> n >> m >> q;
        vector<int> p(n);
        vector<int> v(m);
        vector<int> w(n + 1);
        vector<int> h(n + 1, -1);
        for (int i = 0; i < n; ++i)
        {
            cin >> p[i];
            w[p[i]] = i;
        }
        for (int i = 0; i < m; ++i)
        {
            cin >> v[i];
        }
        int len = 0;
        int last = 0;
        vector<int> u(m + 1);
        vector<int> first(m + 1, -1);
        for (int i = 0; i < m; ++i)
        {
            first[i] = i;
        }
        vector<int> next(m + 1, -1);
        vector<int> ref(m + 1, -1);
        for (int i = 0; i < m; ++i)
        {
            int prev = p[(w[v[i]] - 1 + 2 * n) % n];
            if (prev < h.size() && (h[prev] != -1))
            {
                prev = h[prev];
                if (prev < 0 || prev >= m)
                    while (true);
                if (u[prev] + 1 <= n)
                    first[i] = first[prev];
                else
                {
                    first[i] = next[first[prev]];
                }
                u[i] = min(n, u[prev] + 1);
                next[prev] = i;
            }
            else
            {
                u[i] = 1;
                first[i] = i;
            }
            h[v[i]] = i;
            if (u[i] == n)
                ref[i] = first[i];
        }
        segments seg(ref);
        string ans;
        for (int i = 0; i < q; ++i)
        {
            int l, r;
            cin >> l >> r;
            --l, --r;
            char f = '0';
            if (seg.rmq(1, 0, ref.size() - 1, l, r) >= l)
                f = '1';
            ans += f;
        }
        cout << ans << endl;
    }
};

int main()
{
    std::ios_base::sync_with_stdio(false);
    size_t test_count = 1;
#if 0
    cin >> test_count;
#endif
    for (size_t i = 0; i < test_count; ++i)
    {
        Solution().RunTest(i);
    }
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <cmath>
#include <intrin.h>
using namespace std;

class segments
{
public:
    segments(vector<int>& v) : t(4 * v.size())
    {
        build(v, 1, 0, v.size() - 1);
    }
    int rmq(int v, int tl, int tr, int l, int r)
    {
        if (l > r)
            return -1;
        if (tl == l && tr == r)
            return t[v];
        int tm = (tl + tr) / 2;
        return max
        (
            rmq(2 * v, tl, tm, l, min(r, tm)),
            rmq(2 * v + 1, tm + 1, tr, max(tm + 1, l), r)
        );
    }
private:
    int build(vector<int>& a, int v, int tl, int tr)
    {
        if (tl == tr)
            return t[v] = a[tr];
        int tm = (tl + tr) / 2;
        return t[v] = max(build(a, 2 * v, tl, tm), build(a, 2 * v + 1, tm + 1, tr));
    }
private:
    vector<int> t;
};

struct Solution
{
    void RunTest(size_t test_id)
    {
        int n, m, q;
        cin >> n >> m >> q;
        vector<int> p(n);
        vector<int> v(m);
        vector<int> w(n + 1);
        vector<int> h(n + 1, -1);
        for (int i = 0; i < n; ++i)
        {
            cin >> p[i];
            w[p[i]] = i;
        }
        for (int i = 0; i < m; ++i)
        {
            cin >> v[i];
        }
        int len = 0;
        int last = 0;
        vector<int> u(m + 1);
        vector<int> first(m + 1, -1);
        for (int i = 0; i < m; ++i)
        {
            first[i] = i;
        }
        vector<int> next(m + 1, -1);
        vector<int> ref(m + 1, -1);
        for (int i = 0; i < m; ++i)
        {
            int prev = p[(w[v[i]] - 1 + 2 * n) % n];
            if (prev < h.size() && (h[prev] != -1))
            {
                prev = h[prev];
                if (prev < 0 || prev >= m)
                    while (true);
                if (u[prev] + 1 <= n)
                    first[i] = first[prev];
                else
                {
                    first[i] = next[first[prev]];
                }
                u[i] = min(n, u[prev] + 1);
                next[prev] = i;
            }
            else
            {
                u[i] = 1;
                first[i] = i;
            }
            h[v[i]] = i;
            if (u[i] == n)
                ref[i] = first[i];
        }
        segments seg(ref);
        string ans;
        for (int i = 0; i < q; ++i)
        {
            int l, r;
            cin >> l >> r;
            --l, --r;
            char f = '0';
            if (seg.rmq(1, 0, v.size() - 1, l, r) >= l)
                f = '1';
            ans += f;
        }
        cout << ans << endl;
    }
};

int main()
{
    std::ios_base::sync_with_stdio(false);
    size_t test_count = 1;
#if 0
    cin >> test_count;
#endif
    for (size_t i = 0; i < test_count; ++i)
    {
        Solution().RunTest(i);
    }
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <cmath>
#include <intrin.h>
using namespace std;

struct tree
{
    vector<int64_t> t;
    int n;

    tree(vector<int64_t> & a)
        : n(a.size())
        , t(2 * a.size())
    {
        for (int i = 0; i < n; ++i)
            t[n + i] = a[i];
        for (int i = n - 1; i >= 0; --i)
            t[i] = max(t[i << 1], t[i << 1 | 1]);
    }

    int64_t query(int l, int r)
    {
        int64_t res = -1;
        l = max(l, 0);
        if (l >= r)
            return -1;
        for (l += n, r += n; l < r; l >>= 1, r >>= 1)
        {
            if (l & 1)
                res = max(res, t[l++]);
            if (r & 1)
                res = max(res, t[--r]);
        }
        return res;
    }
};

struct Solution
{
    void RunTest(size_t test_id)
    {
        int n, m, q;
        cin >> n >> m >> q;
        vector<int> p(n);
        vector<int> v(m);
        vector<int> w(n + 1);
        vector<int> h(n + 1, -1);
        for (int i = 0; i < n; ++i)
        {
            cin >> p[i];
            w[p[i]] = i;
        }
        for (int i = 0; i < m; ++i)
        {
            cin >> v[i];
        }
        int len = 0;
        int last = 0;
        vector<int> u(m + 1);
        vector<int> first(m + 1, -1);
        for (int i = 0; i < m; ++i)
        {
            first[i] = i;
        }
        vector<int> next(m + 1, -1);
        vector<int64_t> ref(m + 1, -1);
        for (int i = 0; i < m; ++i)
        {
            int prev = p[(w[v[i]] - 1 + 2 * n) % n];
            if (h[prev] != -1)
            {
                prev = h[prev];
                if (u[prev] + 1 <= n)
                    first[i] = first[prev];
                else
                    first[i] = next[first[prev]];
                u[i] = min(n, u[prev] + 1);
                next[prev] = i;
            }
            else
            {
                u[i] = 1;
                first[i] = i;
            }
            h[v[i]] = i;
            if (u[i] == n)
                ref[i] = first[i];
        }
        tree seg(ref);
        string ans;
        for (int i = 0; i < q; ++i)
        {
            int l, r;
            cin >> l >> r;
            --l, --r;
            char f = '0';
            if (seg.query(l, r + 1) >= l)
                f = '1';
            ans += f;
        }
        cout << ans << endl;
    }
};

int main()
{
    std::ios_base::sync_with_stdio(false);
    size_t test_count = 1;
#if 0
    cin >> test_count;
#endif
    for (size_t i = 0; i < test_count; ++i)
    {
        Solution().RunTest(i);
    }
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <cmath>
#include <intrin.h>
using namespace std;

struct tree
{
    vector<int64_t> t;
    int n;

    tree(vector<int64_t> & a)
        : n(a.size())
        , t(2 * a.size())
    {
        for (int i = 0; i < n; ++i)
            t[n + i] = a[i];
        for (int i = n - 1; i >= 0; --i)
            t[i] = max(t[i << 1], t[i << 1 | 1]);
    }

    int64_t query(int l, int r)
    {
        int64_t res = -1;
        for (l += n, r += n; l < r; l >>= 1, r >>= 1)
        {
            if (l & 1)
                res = max(res, t[l++]);
            if (r & 1)
                res = max(res, t[--r]);
        }
        return res;
    }
};

const int l = 30;

struct Solution
{
    void RunTest(size_t test_id)
    {
        int n, m, q;
        cin >> n >> m >> q;
        vector<int> p(n);
        vector<int> a(m);
        vector<int> w(n + 1);
        vector<int> h(n + 1, -1);
        for (int i = 0; i < n; ++i)
        {
            cin >> p[i];
            w[p[i]] = i;
        }
        for (int i = 0; i < m; ++i)
        {
            cin >> a[i];
        }
        vector<int> dp(m);
        vector<vector<int>> up(m, vector<int>(l+1));
        vector<int64_t> ref(m, -1);
        for (int i = 0; i < m; ++i)
        {
            int prev_value = p[(w[a[i]] - 1 + n) % n];
            if (h[prev_value] != -1)
            {
                int prev = h[prev_value];
                up[i][0] = prev;
                for (int j = 1; j <= l; ++j)
                    up[i][j] = up[up[i][j - 1]][j - 1];
                dp[i] = dp[prev] + 1;
            }
            else
            {
                dp[i] = 1;
            }
            h[a[i]] = i;

            if (dp[i] >= n)
            {
                int z = n - 1;
                int cur = i;
                while (z > 0)
                {
                    for (int j = l; j >= 0; --j)
                    {
                        if ((z & (1 << j)) != 0)
                        {
                            cur = up[cur][j];
                            z = z & ~(1 << j);
                            break;
                        }
                    }
                }
                ref[i] = cur;
            }
        }
        tree seg(ref);
        string ans;
        for (int i = 0; i < q; ++i)
        {
            int l, r;
            cin >> l >> r;
            --l, --r;
            char f = '0';
            if (seg.query(l, r + 1) >= l)
                f = '1';
            ans += f;
        }
        cout << ans << endl;
    }
};

int main()
{
    std::ios_base::sync_with_stdio(false);
    size_t test_count = 1;
#if 0
    cin >> test_count;
#endif
    for (size_t i = 0; i < test_count; ++i)
    {
        Solution().RunTest(i);
    }
}


/*
** Vishal Raj Roy
** Indian Institute of Technology Kharagpur
*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(),x.end()
#define at(X,N) get<N>(X)
#define xx first
#define yy second
#define sz(x) ((int)x.size())
#define nl cout<<"\n";
//fo(i,1,10) gives 1,2,3,....,9 and fo(i,10,1) gives 9,8,....,1 also fo(it, end(v), begin(v)) and fo(it, begin(v), end(v))
// #define fo(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define li long long int
#define fo(i,l,r) for( int i = l-(l>r); i != r-(l>r); i += 1-2*(l>r) )
#define se(X,C) for( auto & X : C )
#define ima INT_MAX
#define imi INT_MIN
#define lma LLONG_MAX
#define lmi LLONG_MIN
#define name(X) (#X)
#define tl(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); tell(_it, args); }
#define tk(args...) take(args);
#define mem(X,A) memset(X,A,sizeof(X))
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

void tell(istream_iterator<string> it) {} template<typename T, typename... Args> void tell(istream_iterator<string> it, T a, Args... args) { cout << *it << " = " << a << "\n"; tell(++it, args...);}
void take() {} template<typename T, typename... Args> void take( T & a, Args & ... args ) { cin>>a; take(args...); }
template <class T> struct custom_hash { static uint64_t splitmix64(uint64_t x) { x += 0x9e3779b97f4a7c15; x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9; x = (x ^ (x >> 27)) * 0x94d049bb133111eb; return x ^ (x >> 31); } T operator()(uint64_t x) const { static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count(); return splitmix64(x + FIXED_RANDOM);} T operator()(tuple<uint64_t,uint64_t> x) const { static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count(); return splitmix64(get<0>(x) + FIXED_RANDOM)^(splitmix64(get<1>(x) + FIXED_RANDOM) >> 1); } }; // T operator()(pair<uint64_t,uint64_t> x) const { static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count(); return splitmix64(x.first + FIXED_RANDOM)^(splitmix64(x.second + FIXED_RANDOM) >> 1); } };
template <class L, class R> ostream & operator<<(ostream &os, pair<L,R> P) { return os << "(" << P.xx << "," << P.yy << ")"; } template<class L, class R> ostream &operator<<(ostream &os, tuple<L,R> P) {return os << "(" << get<0>(P) << "," << get<1>(P) <<")"; } template<class L, class R, class S> ostream &operator<<(ostream &os, tuple<L,R,S> P) { return os << "(" << get<0>(P) << "," << get<1>(P) << ","<< get<2>(P) <<")"; } template<class T, class A> ostream &operator<<(ostream& os, vector<T,A> V) {os /*<< name(V)<< " is "*/ << "\n"; fo(i,0,sz(V)) os <<"  "<< name(V) << "["<<i<<"] = "<< V[i] << "\n"; return os; /*<<"\n";*/ } template<class T, class H, class P, class A> ostream &operator<<(ostream& os, unordered_set<T,H,P,A> S) { os /*name(S) << " is"*/<<" ["; int i = 0; for(auto ELE : S) {os << ELE; if(i < sz(S)-1 ) os<<", "; i++; } return os <<  "]"; /*<<"\n"; */ } template<class S, class T, class H, class P, class A> ostream &operator<<(ostream& os, unordered_map<S,T,H,P,A> M) { os /*name(S) << " is"*/<<"\n"; for( auto ELE : M ) os <<"  "<< name(M) << "["<<ELE.xx<<"] = "<< ELE.yy << "\n"; return os; /*<<"\n";*/ } template<class T, class C, class A> ostream &operator<<(ostream& os, multiset<T,C,A> S) { os /*name(S) << " is"*/<<"["; int i = 0; for(auto ELE : S) {os << ELE; if(i < sz(S)-1 ) os<<", "; i++; } return os <<  "]"; /*<<"\n"; */ } template<class T, class R> ostream &operator<<(ostream& os, gp_hash_table<T,null_type,custom_hash<R>> S) { os /*name(S) << " is"*/<<" ["; int i = 0; for(auto ELE : S) {os << ELE; if(i < sz(S)-1 ) os<<", "; i++; } return os <<  "]"; /*<<"\n"; */ } template<class T, class Z, class R> ostream &operator<<(ostream& os, gp_hash_table<T,Z,custom_hash<R>> M) { os /*name(S) << " is"*/<<"\n"; for( auto ELE : M ) os <<"  "<< name(M) << "["<<ELE.xx<<"] = "<< ELE.yy << "\n"; return os; /*<<"\n";*/ } template<class T, class R> ostream &operator<<(ostream& os, cc_hash_table<T,null_type,custom_hash<R>> S) { os /*name(S) << " is"*/<<" ["; int i = 0; for(auto ELE : S) {os << ELE; if(i < sz(S)-1 ) os<<", "; i++; } return os <<  "]"; /*<<"\n"; */ } template<class T, class Z, class R> ostream &operator<<(ostream& os, cc_hash_table<T,Z,custom_hash<R>> M) { os /*name(S) << " is"*/<<"\n"; for( auto ELE : M ) os <<"  "<< name(M) << "["<<ELE.xx<<"] = "<< ELE.yy << "\n"; return os; /*<<"\n";*/ }
template <class L, class R> istream & operator>>(ostream &os, pair<L,R> & P) { return os>>P.xx>>P.yy; } template <class L> istream & operator>>(istream & os, vector<L> & V) { fo(i,0,sz(V)) os>>V[i]; return os; } template <class L> istream & operator>>(istream & os, vector<vector<L>> & V) { fo(i,0,sz(V)) os>>V[i]; return os; }

using st = string; typedef pair<int, int> ii; typedef pair<int, ii> iii; typedef tuple<int,int> i2; typedef tuple<int,int,int> i3; typedef vector<int> vi; typedef vector<ii> vii; typedef vector<i2> vi2; typedef vector<i3> vi3; typedef vector<iii> viii; typedef vector<vi> vvi; typedef vector<vvi> vvvi; typedef pair<li, li> ll; typedef pair<li, ll> lll; typedef tuple<li,li> l2; typedef tuple<li,li,li> l3; typedef vector<li> vl; typedef vector<ll> vll; typedef vector<l2> vl2; typedef vector<l3> vl3; typedef vector<lll> vlll; typedef vector<vl> vvl; typedef vector<vvl> vvvl; typedef double db; typedef complex<db> cd; typedef vector<cd> vcd; template <class S> using ve = vector<S>; template <class S> using gr = greater<S>; template <class S> using le = less<S>; template <class S, class T = le<S>> using ms =  multiset<S,T>; template <class S,class T = null_type, class R = size_t> using gp =  gp_hash_table<S,T,custom_hash<R>>; template <class S,class T = null_type, class R = size_t> using cc =  cc_hash_table<S,T,custom_hash<R>>; template <class S,class T, class R = size_t> using um =  unordered_map<S,T,custom_hash<R>>; template <class S, class R = size_t> using us =  unordered_set<S,custom_hash<R>>;

const double pi = 2 * acos(0.0);
const int oo = 0x3f3f3f3f; // don't use for long long
const double inf = 1.0/0.0;

class sparse_table {
    public :
    int n;
    int m;
    vvi table;
    sparse_table(vi & v) {
        n = sz(v);
        m = 0;
        while( (1ll<<m) <= n ) m++; m++;
        table.assign(m,vi(n,0));
        fo(i,0,n) table[0][i] = i;
        int pow = 1;
        fo(j,1,m) {
            pow *= 2;
            fo(i,0,n) {
                int r = i+pow-1;
                if( r >= n ) break;
                int v1 = table[j-1][i];
                int v2 = table[j-1][i+pow/2];
                table[j][i] = (v[v1] < v[v2] ? v1 : v2);
            }
        }
    }
    int query( int l, int r, vi & v ) {
        int len = r-l+1;
        int j = 0;
        while( (1ll<<j) <= len ) j++;
        j--;
        int v1 = table[j][l];
        int v2 = table[j][r-(1ll<<j)+1];
        return min(v[v1],v[v2]);
    }
};

void solve() {
    int n,m,q; tk(n,m,q);
    int log = 20;
    vvi dp(log,vi(m+1,m));
    vi p(n,0);
    vi pos(n,0);
    fo(i,0,n) {
        int u; tk(u); u--;
        p[i] = u;
        pos[u] = i;
    }
    vi a(m,0); tk(a);
    se(e,a) e--;
    vi last(n,m);
    fo(i,m,0) {
        int curr = a[i];
        int cpos = pos[curr];
        cpos += 1; cpos %= n;
        int nxt = p[cpos];
        int nindex = last[nxt];
        dp[0][i] = nindex;
        fo(j,1,log) {
            dp[j][i] = dp[j-1][dp[j-1][i]];
        }
        last[curr] = i;
    }
    vi interval(m,m);
    fo(i,0,m) {
        int tot = n-1;
        int k = i;
        fo(j,log,0) {
            if( tot >= (1<<j) ) {
                tot -= (1<<j);
                k = dp[j][k];
            }
        }
        interval[i] = k;
    }
    sparse_table spt(interval);
    // tl(interval);
    while( q-- ) {
        int l,r; tk(l,r); l--, r--;
        cout<<(spt.query(l,r,interval)<=r);
    }
    cout<<"\n";
}

int main() {
    fast;
    int t = 1;
    // cin>>t;
    while( t-- ) solve();
    return 0;
}

/*
Things to take care -->

1. Use all 'li' or all 'int', not a mixture (better use all li)

2. If getting TLE remove solve() and write within the loop

DP on trees ->

1. Write separate block for leaf nodes at starting

2. Make the dp table for combining child nodes memory efficient

3. Take care in condition of when to combine current child with accumulated childs

4. Take care in condition for deriving the dp table of node from the above dp table

*/


/*
** Vishal Raj Roy
** Indian Institute of Technology Kharagpur
*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(),x.end()
#define at(X,N) get<N>(X)
#define xx first
#define yy second
#define sz(x) ((int)x.size())
#define nl cout<<"\n";
//fo(i,1,10) gives 1,2,3,....,9 and fo(i,10,1) gives 9,8,....,1 also fo(it, end(v), begin(v)) and fo(it, begin(v), end(v))
// #define fo(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define li long long int
#define fo(i,l,r) for( int i = l-(l>r); i != r-(l>r); i += 1-2*(l>r) )
#define se(X,C) for( auto & X : C )
#define ima INT_MAX
#define imi INT_MIN
#define lma LLONG_MAX
#define lmi LLONG_MIN
#define name(X) (#X)
#define tl(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); tell(_it, args); }
#define tk(args...) take(args);
#define mem(X,A) memset(X,A,sizeof(X))
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

void tell(istream_iterator<string> it) {} template<typename T, typename... Args> void tell(istream_iterator<string> it, T a, Args... args) { cout << *it << " = " << a << "\n"; tell(++it, args...);}
void take() {} template<typename T, typename... Args> void take( T & a, Args & ... args ) { cin>>a; take(args...); }
template <class T> struct custom_hash { static uint64_t splitmix64(uint64_t x) { x += 0x9e3779b97f4a7c15; x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9; x = (x ^ (x >> 27)) * 0x94d049bb133111eb; return x ^ (x >> 31); } T operator()(uint64_t x) const { static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count(); return splitmix64(x + FIXED_RANDOM);} T operator()(tuple<uint64_t,uint64_t> x) const { static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count(); return splitmix64(get<0>(x) + FIXED_RANDOM)^(splitmix64(get<1>(x) + FIXED_RANDOM) >> 1); } }; // T operator()(pair<uint64_t,uint64_t> x) const { static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count(); return splitmix64(x.first + FIXED_RANDOM)^(splitmix64(x.second + FIXED_RANDOM) >> 1); } };
template <class L, class R> ostream & operator<<(ostream &os, pair<L,R> P) { return os << "(" << P.xx << "," << P.yy << ")"; } template<class L, class R> ostream &operator<<(ostream &os, tuple<L,R> P) {return os << "(" << get<0>(P) << "," << get<1>(P) <<")"; } template<class L, class R, class S> ostream &operator<<(ostream &os, tuple<L,R,S> P) { return os << "(" << get<0>(P) << "," << get<1>(P) << ","<< get<2>(P) <<")"; } template<class T, class A> ostream &operator<<(ostream& os, vector<T,A> V) {os /*<< name(V)<< " is "*/ << "\n"; fo(i,0,sz(V)) os <<"  "<< name(V) << "["<<i<<"] = "<< V[i] << "\n"; return os; /*<<"\n";*/ } template<class T, class H, class P, class A> ostream &operator<<(ostream& os, unordered_set<T,H,P,A> S) { os /*name(S) << " is"*/<<" ["; int i = 0; for(auto ELE : S) {os << ELE; if(i < sz(S)-1 ) os<<", "; i++; } return os <<  "]"; /*<<"\n"; */ } template<class S, class T, class H, class P, class A> ostream &operator<<(ostream& os, unordered_map<S,T,H,P,A> M) { os /*name(S) << " is"*/<<"\n"; for( auto ELE : M ) os <<"  "<< name(M) << "["<<ELE.xx<<"] = "<< ELE.yy << "\n"; return os; /*<<"\n";*/ } template<class T, class C, class A> ostream &operator<<(ostream& os, multiset<T,C,A> S) { os /*name(S) << " is"*/<<"["; int i = 0; for(auto ELE : S) {os << ELE; if(i < sz(S)-1 ) os<<", "; i++; } return os <<  "]"; /*<<"\n"; */ } template<class T, class R> ostream &operator<<(ostream& os, gp_hash_table<T,null_type,custom_hash<R>> S) { os /*name(S) << " is"*/<<" ["; int i = 0; for(auto ELE : S) {os << ELE; if(i < sz(S)-1 ) os<<", "; i++; } return os <<  "]"; /*<<"\n"; */ } template<class T, class Z, class R> ostream &operator<<(ostream& os, gp_hash_table<T,Z,custom_hash<R>> M) { os /*name(S) << " is"*/<<"\n"; for( auto ELE : M ) os <<"  "<< name(M) << "["<<ELE.xx<<"] = "<< ELE.yy << "\n"; return os; /*<<"\n";*/ } template<class T, class R> ostream &operator<<(ostream& os, cc_hash_table<T,null_type,custom_hash<R>> S) { os /*name(S) << " is"*/<<" ["; int i = 0; for(auto ELE : S) {os << ELE; if(i < sz(S)-1 ) os<<", "; i++; } return os <<  "]"; /*<<"\n"; */ } template<class T, class Z, class R> ostream &operator<<(ostream& os, cc_hash_table<T,Z,custom_hash<R>> M) { os /*name(S) << " is"*/<<"\n"; for( auto ELE : M ) os <<"  "<< name(M) << "["<<ELE.xx<<"] = "<< ELE.yy << "\n"; return os; /*<<"\n";*/ }
template <class L, class R> istream & operator>>(ostream &os, pair<L,R> & P) { return os>>P.xx>>P.yy; } template <class L> istream & operator>>(istream & os, vector<L> & V) { fo(i,0,sz(V)) os>>V[i]; return os; } template <class L> istream & operator>>(istream & os, vector<vector<L>> & V) { fo(i,0,sz(V)) os>>V[i]; return os; }

using st = string; typedef pair<int, int> ii; typedef pair<int, ii> iii; typedef tuple<int,int> i2; typedef tuple<int,int,int> i3; typedef vector<int> vi; typedef vector<ii> vii; typedef vector<i2> vi2; typedef vector<i3> vi3; typedef vector<iii> viii; typedef vector<vi> vvi; typedef vector<vvi> vvvi; typedef pair<li, li> ll; typedef pair<li, ll> lll; typedef tuple<li,li> l2; typedef tuple<li,li,li> l3; typedef vector<li> vl; typedef vector<ll> vll; typedef vector<l2> vl2; typedef vector<l3> vl3; typedef vector<lll> vlll; typedef vector<vl> vvl; typedef vector<vvl> vvvl; typedef double db; typedef complex<db> cd; typedef vector<cd> vcd; template <class S> using ve = vector<S>; template <class S> using gr = greater<S>; template <class S> using le = less<S>; template <class S, class T = le<S>> using ms =  multiset<S,T>; template <class S,class T = null_type, class R = size_t> using gp =  gp_hash_table<S,T,custom_hash<R>>; template <class S,class T = null_type, class R = size_t> using cc =  cc_hash_table<S,T,custom_hash<R>>; template <class S,class T, class R = size_t> using um =  unordered_map<S,T,custom_hash<R>>; template <class S, class R = size_t> using us =  unordered_set<S,custom_hash<R>>;

const double pi = 2 * acos(0.0);
const int oo = 0x3f3f3f3f; // don't use for long long
const double inf = 1.0/0.0;

class segtree {
    public :
    vi tree;
    int n;
    segtree( int N, vi & v ) {
        n = N;
        tree.assign(4*n+4,0);
        build(1,0,n-1,v);
    }
    int LE( int node ) { return (node<<1); }
    void push_up( int node, int le, int ri ) {
        tree[node] = min(tree[le],tree[ri]);
    }
    void build( int node, int l, int r, vi & v ) {
        if( l == r ) {
            tree[node] = v[l];
            return;
        }
        int m = (l+r)/2;
        int le = LE(node), ri = le+1;
        build(le,l,m,v); build(ri,m+1,r,v);
        push_up(node,le,ri);
    }
    int query( int node, int l, int r, int ql, int qr ) {
        if( ql > qr ) return ima;
        if( l == ql && r == qr ) {
            return tree[node];
        }
        int m = (l+r)/2;
        int le = LE(node), ri = le+1;
        return min(query(le,l,m,ql,min(m,qr)),query(ri,m+1,r,max(m+1,ql),qr));
    }
};

void solve() {
    int n,m,q; tk(n,m,q);
    int log = 20;
    vvi dp(log,vi(m+1,m));
    vi p(n,0);
    vi pos(n,0);
    fo(i,0,n) {
        int u; tk(u); u--;
        p[i] = u;
        pos[u] = i;
    }
    vi a(m,0); tk(a);
    se(e,a) e--;
    vi last(n,m);
    fo(i,m,0) {
        int curr = a[i];
        int cpos = pos[curr];
        cpos += 1; cpos %= n;
        int nxt = p[cpos];
        int nindex = last[nxt];
        dp[0][i] = nindex;
        fo(j,1,log) {
            dp[j][i] = dp[j-1][dp[j-1][i]];
        }
        last[curr] = i;
    }
    vi interval(m,m);
    fo(i,0,m) {
        int tot = n-1;
        int k = i;
        fo(j,log,0) {
            if( tot >= (1<<j) ) {
                tot -= (1<<j);
                k = dp[j][k];
            }
        }
        interval[i] = k;
    }
    segtree tr(m,interval);
    // tl(interval);
    while( q-- ) {
        int l,r; tk(l,r); l--, r--;
        cout<<(tr.query(1,0,m-1,l,r)<=r);
    }
    cout<<"\n";
}

int main() {
    fast;
    int t = 1;
    // cin>>t;
    while( t-- ) solve();
    return 0;
}

/*
Things to take care -->

1. Use all 'li' or all 'int', not a mixture (better use all li)

2. If getting TLE remove solve() and write within the loop

DP on trees ->

1. Write separate block for leaf nodes at starting

2. Make the dp table for combining child nodes memory efficient

3. Take care in condition of when to combine current child with accumulated childs

4. Take care in condition for deriving the dp table of node from the above dp table

*/


/**
*   author : SheRlocked_221B
*   created : 29/09/2020
*
**/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> //required
#include <ext/pb_ds/tree_policy.hpp> //required
#define pb push_back
#define pf push_front
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define distinct(x) sort(all(x)); x.resize(unique(all(x))-x.begin());
#define sz(x)  (long long)(x).size()
#define sqr(x) (x)*(x)
#define sof sizeof
#define resz resize
#define ins insert
#define lowerB lower_bound
#define upperB upper_bound
#define mkp make_pair
#define mkt make_tuple
#define act(a,v) (get<(long long)a>(v))
#define mod 1000000007
#define mod1 998244353
#define N 200003  //N idhar hai
#define inf 1e18
#define minf -1e18
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define ms(dp,a) memset(dp,(ll)a,sof(dp))
#define Foreach(i, c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define fr(i,b) for(int (i)=(0);(i) < (b); ++(i))
#define For(i,a,b) for(int (i)=(a);(i) < (b); ++(i))
#define rof(i,a,b) for(int (i)=(a);(i) >= (b); --(i))
#define rep(i, c) for(auto &(i) : (c))
#define FastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define PRECISION(n) std::cout.unsetf ( std::ios::floatfield );std::cout.precision((ll)n)
#define getsm(v) accumulate(all(v),(ll)0)
#define getmx(v) max_element(all(v))
#define getmn(v) min_element(all(v))
#define ws1(a) cout<<(a)<<" "
#define wr1(a) cout<<(a)<<endl
#define wr2(a,b) cout<<(a)<<" "<<(b)<<endl
#define wr3(a,b,c) cout<<(a)<<" "<<(b)<<" "<<(c)<<endl
#define wr4(a,b,c,d) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<endl
#define ww1(a) cout<<(a)<<"\n"
#define ww2(a,b) cout<<(a)<<" "<<(b)<<"\n"
#define ww3(a,b,c) cout<<(a)<<" "<<(b)<<" "<<(c)<<"\n"
#define ww4(a,b,c,d) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<"\n"
#define FileIO freopen("input.txt","r",stdin);freopen("output.txt","w",stdout)
#define fill(dp,a,b) for(int i=0;i<a;i++)for(int j=0;j<b;j++)dp[i][j]=-1;
#define PI 3.14159265358979323846264338327950288419716939937510
#define fi first
#define se second
#define here cout<<"RSSB"<<endl
#define dbg cout<<"Krishna"<<endl
#define showzero cout<<std::showpoint
#define bitcount( x ) (ll)__builtin_popcountll( x )
#define ls(i) (1ll<<(i))
using namespace __gnu_pbds; //required
using namespace  std ;
typedef double db;
typedef int ll ; //long long
typedef vector<int>vi ;
//typedef vector<l>vl ;
typedef vector<ll>vll ;
typedef vector<vector<ll> >vvl ;
typedef pair<int,int> pii ;
typedef pair<ll,ll> pll ;
typedef vector<pll>vpll;
typedef vector<string>vstr;
typedef vector<bool>vbool ;
template <typename T> using ordered_set =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
void READ(vll &v, ll n){ll a ;for(ll i=0 ; i<n ; i=i+1){cin>>a ;v.pb(a);}}
void PRINT(vll &v , ll a = 0){for(ll i=a ; i<v.size() ; i=i+1){/*v[i] = max((ll)0,v[i]);*/cout<<v[i]<<" " ;}cout<<"\n" ;}
double logy(ll n , ll b){if(b==0){return(-1);}if(n==1){return(0);}return((db)log10(n)/(db)log10(b));}
long long power(long long k , long long n , long long m=mod){long long res = 1;while(n){if(n%2!=0){res = (res*k)%m ;}k = (k*k)%m ;n = n/2 ;}return(res) ;}
double powerD(double k , long long n ){double res = 1;while(n){if(n%2!=0){res = (res*k) ;}k = (k*k) ;n = n/2 ;}return(res) ;}
ll gcdExtend(ll a , ll b , ll &x , ll &y){if(a==0){x = 0;y = 1;return(b);}ll x1,y1;ll g = gcdExtend(b%a,a,x1,y1);x = y1 - (b/a)*x1;y = x1;return(g);}
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
#define lcm(a,b) ((a/gcd(a,b))*b)
void mul(ll &x , ll a){if(a<0){a+=mod;}else{a%=mod;}x = (x%mod*a%mod)%mod;}
double distance(pair<db,db> a , pair<db,db> b){return((db)(sqrt( sqr(a.fi-b.fi) + sqr(a.se-b.se))));}
ll n,m,k,h,a1,a2,a3;
//db prob;
string str,st;
bool ok = true;
vll v,g,nxt,pre;
vvl tmp;
ll dpo[N],dpp[N];
ll solvep(ll i)
{
    if(i>=m)
    {
        return(m);
    }
    if(dpp[i]!=-1)
    {
        return(dpp[i]);
    }
    ll ans = m;
    ll a = g[i];
    ll b = nxt[a];
    ll c = lowerB(all(tmp[b]),i) - tmp[b].begin();
    if(c!=sz(tmp[b]))
    {
        ll d = tmp[b][c];
        ans = solvep(d);
    }
    dpp[i] = ans;
    return(ans);
}
ll solveo(ll i)
{
    if(i<0)
    {
        return(m);
    }
    if(dpo[i]!=-1)
    {
        return(dpo[i]);
    }
    ll ans = m;
    ll a = g[i];
    ll b = pre[a];
    ll c = lowerB(all(tmp[b]),i) - tmp[b].begin() - 1;
    if(c!=-1)
    {
        ll d = tmp[b][c];
        //ww3(i,d,b);
        ans = solveo(d);
    }
    dpo[i] = ans;
    return(ans);
}
void solveIt()
{
    //NOWECANTBEDEFEATED
    ll a,b,c,d,i,j,x,y,z,t;
    ll p,q,r,w,u;
    string str1,str2;
    char ch;
    cin>>n>>m>>q;
    for(i=0 ; i<m+2 ; i++)
    {
        dpo[i] = dpp[i] = -1;
    }
    READ(v,n);
    READ(g,m);
    nxt.resz(n+1);
    pre.resz(n+1);
    for(i=0 ; i<n-1;  i++)
    {
        a = v[i];
        b = v[i+1];
        nxt[a] = b;
        pre[b] = a;
    }
    nxt[v.back()] = v.front();
    pre[v.front()] = v.back();
    tmp.resz(n+1);
    for(i=0 ; i<m ; i++)
    {
        a = g[i];
        tmp[a].pb(i);
        if(a==v.back())
        {
            dpp[i] = i;
        }
        if(a==v.front())
        {
            dpo[i] = i;
        }
    }
    //ww1(solveo(2));
    vvl gmp(n+1);
    for(i=0 ; i<m ; i++)
    {
        solvep(i);
        a = solveo(i);
        gmp[g[i]].pb(a);
    }
    // for(i=0 ; i<m ; i++)
    // {
    //     ws1(dpo[i]);
    // }
    // ww1("");
    // for(i=0 ; i<m ; i++)
    // {
    //     ws1(dpp[i]);
    // }
    // ww1("");
    for(i=0 ; i<n ; i++)
    {
        sort(all(gmp[g[i]]));
    }
    vll ans(m,m);
    for(i=0 ;i<m ; i++)
    {
        a = g[i];
        if(dpp[i]==m)
        {
            //ans[i] = m;
            continue;
        }
        if(a==v.front())
        {
            ans[i] = dpp[i];
            //ww2(i,dpp[i]);
            continue;
        }
        b = nxt[a];
        c = pre[a];
        d = m;
        // for(auto p : tmp[c])
        // {
        //     if(dpo[p]!=m && dpo[p]>dpp[i])
        //     {
        //         d = min(d,p);
        //     }
        // }
        x = lowerB(all(gmp[c]),dpp[i]) - gmp[c].begin();
        if(x!=sz(gmp[c]))
        {
            d = gmp[c][x];
        }
        ans[i] = d;
    }
    //PRINT(ans);
    for(i=m-2 ; i>=0 ; i--)
    {
        ans[i] = min(ans[i],ans[i+1]);
    }
    while(q--)
    {
        cin>>a>>b;
        a--;
        b--;
        if(ans[a]<=b)
        {
            cout<<"1";
        }
        else
        {
            cout<<"0";
        }
    }
    ww1("");
}
int main()
{
#ifndef ONLINE_JUDGE
        freopen("Rinput.txt", "r", stdin);
        freopen("Routput.txt", "w", stdout);
#endif
    FastIO;
    PRECISION(15);
    //FileIO;
    //dr.pb(mkp(0,1));dr.pb(mkp(1,0));dr.pb(mkp(0,-1));dr.pb(mkp(-1,0));
    ll t = 1;
    //cin>>t;
    while(t--)
    {
        solveIt();
    }
    // const ll ddx[8] = {-1, -1, -1, 0, 1, 1, 1, 0};
    // const ll ddy[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
    //WhateverItTakes
    //FOCUS
    //BeABelieverWarrior
    //DO IT UNTIL YOU RUN OUT OF IDEAS ~ YOU KNOW WHO
    //See The Editorial Almost Never ~ YOU KNOW WHO
    /*In Case of TLE -> 1.Use Int instead of Long Long
                    2.Use FastIO
                    3.Use "\n" Instead of endl
                    4.Use Vector and Arrays instead of Sets,Maps(if possible)
    */
}


/**
*   author : SheRlocked_221B
*   created : 29/09/2020
*
**/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> //required
#include <ext/pb_ds/tree_policy.hpp> //required
#define pb push_back
#define pf push_front
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define distinct(x) sort(all(x)); x.resize(unique(all(x))-x.begin());
#define sz(x)  (long long)(x).size()
#define sqr(x) (x)*(x)
#define sof sizeof
#define resz resize
#define ins insert
#define lowerB lower_bound
#define upperB upper_bound
#define mkp make_pair
#define mkt make_tuple
#define act(a,v) (get<(long long)a>(v))
#define mod 1000000007
#define mod1 998244353
#define N 200003  //N idhar hai
#define inf 1e18
#define minf -1e18
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define ms(dp,a) memset(dp,(ll)a,sof(dp))
#define Foreach(i, c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define fr(i,b) for(int (i)=(0);(i) < (b); ++(i))
#define For(i,a,b) for(int (i)=(a);(i) < (b); ++(i))
#define rof(i,a,b) for(int (i)=(a);(i) >= (b); --(i))
#define rep(i, c) for(auto &(i) : (c))
#define FastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define PRECISION(n) std::cout.unsetf ( std::ios::floatfield );std::cout.precision((ll)n)
#define getsm(v) accumulate(all(v),(ll)0)
#define getmx(v) max_element(all(v))
#define getmn(v) min_element(all(v))
#define ws1(a) cout<<(a)<<" "
#define wr1(a) cout<<(a)<<endl
#define wr2(a,b) cout<<(a)<<" "<<(b)<<endl
#define wr3(a,b,c) cout<<(a)<<" "<<(b)<<" "<<(c)<<endl
#define wr4(a,b,c,d) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<endl
#define ww1(a) cout<<(a)<<"\n"
#define ww2(a,b) cout<<(a)<<" "<<(b)<<"\n"
#define ww3(a,b,c) cout<<(a)<<" "<<(b)<<" "<<(c)<<"\n"
#define ww4(a,b,c,d) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<"\n"
#define FileIO freopen("input.txt","r",stdin);freopen("output.txt","w",stdout)
#define fill(dp,a,b) for(int i=0;i<a;i++)for(int j=0;j<b;j++)dp[i][j]=-1;
#define PI 3.14159265358979323846264338327950288419716939937510
#define fi first
#define se second
#define here cout<<"RSSB"<<endl
#define dbg cout<<"Krishna"<<endl
#define showzero cout<<std::showpoint
#define bitcount( x ) (ll)__builtin_popcountll( x )
#define ls(i) (1ll<<(i))
using namespace __gnu_pbds; //required
using namespace  std ;
typedef double db;
typedef int ll ; //long long
typedef vector<int>vi ;
//typedef vector<l>vl ;
typedef vector<ll>vll ;
typedef vector<vector<ll> >vvl ;
typedef pair<int,int> pii ;
typedef pair<ll,ll> pll ;
typedef vector<pll>vpll;
typedef vector<string>vstr;
typedef vector<bool>vbool ;
template <typename T> using ordered_set =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
void READ(vll &v, ll n){ll a ;for(ll i=0 ; i<n ; i=i+1){cin>>a ;v.pb(a);}}
void PRINT(vll &v , ll a = 0){for(ll i=a ; i<v.size() ; i=i+1){/*v[i] = max((ll)0,v[i]);*/cout<<v[i]<<" " ;}cout<<"\n" ;}
double logy(ll n , ll b){if(b==0){return(-1);}if(n==1){return(0);}return((db)log10(n)/(db)log10(b));}
long long power(long long k , long long n , long long m=mod){long long res = 1;while(n){if(n%2!=0){res = (res*k)%m ;}k = (k*k)%m ;n = n/2 ;}return(res) ;}
double powerD(double k , long long n ){double res = 1;while(n){if(n%2!=0){res = (res*k) ;}k = (k*k) ;n = n/2 ;}return(res) ;}
ll gcdExtend(ll a , ll b , ll &x , ll &y){if(a==0){x = 0;y = 1;return(b);}ll x1,y1;ll g = gcdExtend(b%a,a,x1,y1);x = y1 - (b/a)*x1;y = x1;return(g);}
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
#define lcm(a,b) ((a/gcd(a,b))*b)
void mul(ll &x , ll a){if(a<0){a+=mod;}else{a%=mod;}x = (x%mod*a%mod)%mod;}
double distance(pair<db,db> a , pair<db,db> b){return((db)(sqrt( sqr(a.fi-b.fi) + sqr(a.se-b.se))));}
ll n,m,k,h,a1,a2,a3;
//db prob;
string str,st;
bool ok = true;
vll v,g,nxt,pre;
vvl tmp;
ll dpo[N],dpp[N];
ll solvep(ll i)
{
    if(i>=m)
    {
        return(m);
    }
    if(dpp[i]!=-1)
    {
        return(dpp[i]);
    }
    ll ans = m;
    ll a = g[i];
    ll b = nxt[a];
    ll c = lowerB(all(tmp[b]),i) - tmp[b].begin();
    if(c!=sz(tmp[b]))
    {
        ll d = tmp[b][c];
        ans = solvep(d);
    }
    dpp[i] = ans;
    return(ans);
}
ll solveo(ll i)
{
    if(i<0)
    {
        return(m);
    }
    if(dpo[i]!=-1)
    {
        return(dpo[i]);
    }
    ll ans = m;
    ll a = g[i];
    ll b = pre[a];
    ll c = lowerB(all(tmp[b]),i) - tmp[b].begin() - 1;
    if(c!=-1)
    {
        ll d = tmp[b][c];
        //ww3(i,d,b);
        ans = solveo(d);
    }
    dpo[i] = ans;
    return(ans);
}
void solveIt()
{
    //NOWECANTBEDEFEATED
    ll a,b,c,d,i,j,x,y,z,t;
    ll p,q,r,w,u;
    string str1,str2;
    char ch;
    cin>>n>>m>>q;
    for(i=0 ; i<m+2 ; i++)
    {
        dpo[i] = dpp[i] = -1;
    }
    READ(v,n);
    READ(g,m);
    nxt.resz(n+1);
    pre.resz(n+1);
    for(i=0 ; i<n-1;  i++)
    {
        a = v[i];
        b = v[i+1];
        nxt[a] = b;
        pre[b] = a;
    }
    nxt[v.back()] = v.front();
    pre[v.front()] = v.back();
    tmp.resz(n+1);
    for(i=0 ; i<m ; i++)
    {
        a = g[i];
        tmp[a].pb(i);
        if(a==v.back())
        {
            dpp[i] = i;
        }
        if(a==v.front())
        {
            dpo[i] = i;
        }
    }
    //ww1(solveo(2));
    for(i=0 ; i<m ; i++)
    {
        solvep(i);
        solveo(i);
    }
    // for(i=0 ; i<m ; i++)
    // {
    //     ws1(dpo[i]);
    // }
    // ww1("");
    // for(i=0 ; i<m ; i++)
    // {
    //     ws1(dpp[i]);
    // }
    // ww1("");
    vll ans(m,m);
    vll go(n+1,0);
    for(i=0 ;i<m ; i++)
    {
        a = g[i];
        if(dpp[i]==m)
        {
            //ans[i] = m;
            continue;
        }
        if(a==v.front())
        {
            ans[i] = dpp[i];
            //ww2(i,dpp[i]);
            continue;
        }
        b = nxt[a];
        c = pre[a];
        d = m;
        for(j=go[c] ; j<sz(tmp[c]) ; j++)
        {
            p = tmp[c][j];
            if(dpo[p]!=m && dpo[p]>dpp[i])
            {
                d = min(d,p);
            }
        }
        go[a]++;
        ans[i] = d;
    }
    //PRINT(ans);
    for(i=m-2 ; i>=0 ; i--)
    {
        ans[i] = min(ans[i],ans[i+1]);
    }

    while(q--)
    {
        cin>>a>>b;
        a--;
        b--;
        if(ans[a]<=b)
        {
            cout<<"1";
        }
        else
        {
            cout<<"0";
        }
    }
    ww1("");
}
int main()
{
#ifndef ONLINE_JUDGE
        freopen("Rinput.txt", "r", stdin);
        freopen("Routput.txt", "w", stdout);
#endif
    FastIO;
    PRECISION(15);
    //FileIO;
    //dr.pb(mkp(0,1));dr.pb(mkp(1,0));dr.pb(mkp(0,-1));dr.pb(mkp(-1,0));
    ll t = 1;
    //cin>>t;
    while(t--)
    {
        solveIt();
    }
    // const ll ddx[8] = {-1, -1, -1, 0, 1, 1, 1, 0};
    // const ll ddy[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
    //WhateverItTakes
    //FOCUS
    //BeABelieverWarrior
    //DO IT UNTIL YOU RUN OUT OF IDEAS ~ YOU KNOW WHO
    //See The Editorial Almost Never ~ YOU KNOW WHO
    /*In Case of TLE -> 1.Use Int instead of Long Long
                    2.Use FastIO
                    3.Use "\n" Instead of endl
                    4.Use Vector and Arrays instead of Sets,Maps(if possible)
    */
}


/**
*   author : SheRlocked_221B
*   created : 29/09/2020
*
**/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> //required
#include <ext/pb_ds/tree_policy.hpp> //required
#define pb push_back
#define pf push_front
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define distinct(x) sort(all(x)); x.resize(unique(all(x))-x.begin());
#define sz(x)  (long long)(x).size()
#define sqr(x) (x)*(x)
#define sof sizeof
#define resz resize
#define ins insert
#define lowerB lower_bound
#define upperB upper_bound
#define mkp make_pair
#define mkt make_tuple
#define act(a,v) (get<(long long)a>(v))
#define mod 1000000007
#define mod1 998244353
#define N 200003  //N idhar hai
#define inf 1e18
#define minf -1e18
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define ms(dp,a) memset(dp,(ll)a,sof(dp))
#define Foreach(i, c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define fr(i,b) for(int (i)=(0);(i) < (b); ++(i))
#define For(i,a,b) for(int (i)=(a);(i) < (b); ++(i))
#define rof(i,a,b) for(int (i)=(a);(i) >= (b); --(i))
#define rep(i, c) for(auto &(i) : (c))
#define FastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define PRECISION(n) std::cout.unsetf ( std::ios::floatfield );std::cout.precision((ll)n)
#define getsm(v) accumulate(all(v),(ll)0)
#define getmx(v) max_element(all(v))
#define getmn(v) min_element(all(v))
#define ws1(a) cout<<(a)<<" "
#define wr1(a) cout<<(a)<<endl
#define wr2(a,b) cout<<(a)<<" "<<(b)<<endl
#define wr3(a,b,c) cout<<(a)<<" "<<(b)<<" "<<(c)<<endl
#define wr4(a,b,c,d) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<endl
#define ww1(a) cout<<(a)<<"\n"
#define ww2(a,b) cout<<(a)<<" "<<(b)<<"\n"
#define ww3(a,b,c) cout<<(a)<<" "<<(b)<<" "<<(c)<<"\n"
#define ww4(a,b,c,d) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<"\n"
#define FileIO freopen("input.txt","r",stdin);freopen("output.txt","w",stdout)
#define fill(dp,a,b) for(int i=0;i<a;i++)for(int j=0;j<b;j++)dp[i][j]=-1;
#define PI 3.14159265358979323846264338327950288419716939937510
#define fi first
#define se second
#define here cout<<"RSSB"<<endl
#define dbg cout<<"Krishna"<<endl
#define showzero cout<<std::showpoint
#define bitcount( x ) (ll)__builtin_popcountll( x )
#define ls(i) (1ll<<(i))
using namespace __gnu_pbds; //required
using namespace  std ;
typedef double db;
typedef int ll ; //long long
typedef vector<int>vi ;
//typedef vector<l>vl ;
typedef vector<ll>vll ;
typedef vector<vector<ll> >vvl ;
typedef pair<int,int> pii ;
typedef pair<ll,ll> pll ;
typedef vector<pll>vpll;
typedef vector<string>vstr;
typedef vector<bool>vbool ;
template <typename T> using ordered_set =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
void READ(vll &v, ll n){ll a ;for(ll i=0 ; i<n ; i=i+1){cin>>a ;v.pb(a);}}
void PRINT(vll &v , ll a = 0){for(ll i=a ; i<v.size() ; i=i+1){/*v[i] = max((ll)0,v[i]);*/cout<<v[i]<<" " ;}cout<<"\n" ;}
double logy(ll n , ll b){if(b==0){return(-1);}if(n==1){return(0);}return((db)log10(n)/(db)log10(b));}
long long power(long long k , long long n , long long m=mod){long long res = 1;while(n){if(n%2!=0){res = (res*k)%m ;}k = (k*k)%m ;n = n/2 ;}return(res) ;}
double powerD(double k , long long n ){double res = 1;while(n){if(n%2!=0){res = (res*k) ;}k = (k*k) ;n = n/2 ;}return(res) ;}
ll gcdExtend(ll a , ll b , ll &x , ll &y){if(a==0){x = 0;y = 1;return(b);}ll x1,y1;ll g = gcdExtend(b%a,a,x1,y1);x = y1 - (b/a)*x1;y = x1;return(g);}
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
#define lcm(a,b) ((a/gcd(a,b))*b)
void mul(ll &x , ll a){if(a<0){a+=mod;}else{a%=mod;}x = (x%mod*a%mod)%mod;}
double distance(pair<db,db> a , pair<db,db> b){return((db)(sqrt( sqr(a.fi-b.fi) + sqr(a.se-b.se))));}
ll n,m,k,h,a1,a2,a3;
//db prob;
string str,st;
bool ok = true;
vll v,g,nxt,pre;
vvl tmp;
ll dpo[N],dpp[N];
ll solvep(ll i)
{
    if(i>=m)
    {
        return(m);
    }
    if(dpp[i]!=-1)
    {
        return(dpp[i]);
    }
    ll ans = m;
    ll a = g[i];
    ll b = nxt[a];
    ll c = lowerB(all(tmp[b]),i) - tmp[b].begin();
    if(c!=sz(tmp[b]))
    {
        ll d = tmp[b][c];
        ans = solvep(d);
    }
    dpp[i] = ans;
    return(ans);
}
ll solveo(ll i)
{
    if(i<0)
    {
        return(m);
    }
    if(dpo[i]!=-1)
    {
        return(dpo[i]);
    }
    ll ans = m;
    ll a = g[i];
    ll b = pre[a];
    ll c = lowerB(all(tmp[b]),i) - tmp[b].begin() - 1;
    if(c!=-1)
    {
        ll d = tmp[b][c];
        //ww3(i,d,b);
        ans = solveo(d);
    }
    dpo[i] = ans;
    return(ans);
}
void solveIt()
{
    //NOWECANTBEDEFEATED
    ll a,b,c,d,i,j,x,y,z,t;
    ll p,q,r,w,u;
    string str1,str2;
    char ch;
    cin>>n>>m>>q;
    for(i=0 ; i<m+2 ; i++)
    {
        dpo[i] = dpp[i] = -1;
    }
    READ(v,n);
    READ(g,m);
    nxt.resz(n+1);
    pre.resz(n+1);
    for(i=0 ; i<n-1;  i++)
    {
        a = v[i];
        b = v[i+1];
        nxt[a] = b;
        pre[b] = a;
    }
    nxt[v.back()] = v.front();
    pre[v.front()] = v.back();
    tmp.resz(n+1);
    for(i=0 ; i<m ; i++)
    {
        a = g[i];
        tmp[a].pb(i);
        if(a==v.back())
        {
            dpp[i] = i;
        }
        if(a==v.front())
        {
            dpo[i] = i;
        }
    }
    //ww1(solveo(2));
    for(i=0 ; i<m ; i++)
    {
        solvep(i);
        solveo(i);
    }
    // for(i=0 ; i<m ; i++)
    // {
    //     ws1(dpo[i]);
    // }
    // ww1("");
    // for(i=0 ; i<m ; i++)
    // {
    //     ws1(dpp[i]);
    // }
    // ww1("");
    vll ans(m,m);
    for(i=0 ;i<m ; i++)
    {
        a = g[i];
        if(dpp[i]==m)
        {
            //ans[i] = m;
            continue;
        }
        if(a==v.front())
        {
            ans[i] = dpp[i];
            //ww2(i,dpp[i]);
            continue;
        }
        b = nxt[a];
        c = pre[a];
        d = m;
        for(auto p : tmp[c])
        {
            if(dpo[p]!=m && dpo[p]>dpp[i])
            {
                d = min(d,p);
            }
        }
        ans[i] = d;
    }
    //PRINT(ans);
    for(i=m-2 ; i>=0 ; i--)
    {
        ans[i] = min(ans[i],ans[i+1]);
    }

    while(q--)
    {
        cin>>a>>b;
        a--;
        b--;
        if(ans[a]<=b)
        {
            cout<<"1";
        }
        else
        {
            cout<<"0";
        }
    }
    ww1("");
}
int main()
{
#ifndef ONLINE_JUDGE
        freopen("Rinput.txt", "r", stdin);
        freopen("Routput.txt", "w", stdout);
#endif
    FastIO;
    PRECISION(15);
    //FileIO;
    //dr.pb(mkp(0,1));dr.pb(mkp(1,0));dr.pb(mkp(0,-1));dr.pb(mkp(-1,0));
    ll t = 1;
    //cin>>t;
    while(t--)
    {
        solveIt();
    }
    // const ll ddx[8] = {-1, -1, -1, 0, 1, 1, 1, 0};
    // const ll ddy[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
    //WhateverItTakes
    //FOCUS
    //BeABelieverWarrior
    //DO IT UNTIL YOU RUN OUT OF IDEAS ~ YOU KNOW WHO
    //See The Editorial Almost Never ~ YOU KNOW WHO
    /*In Case of TLE -> 1.Use Int instead of Long Long
                    2.Use FastIO
                    3.Use "\n" Instead of endl
                    4.Use Vector and Arrays instead of Sets,Maps(if possible)
    */
}