Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- const int M = 4001;
- const int N = 1e5 + 1;
- bitset<M> a[N], b[N], pa, pb, res;
- signed main()
- {
- ios_base::sync_with_stdio(false);
- cin.tie(NULL); cout.tie(NULL);
- #ifndef ONLINE_JUDGE
- freopen("input.txt", "r", stdin);
- freopen("output.txt", "w", stdout);
- #endif
- int n, m, q;
- cin >> n >> m >> q;
- for (int i = 1; i <= n; i++)
- {
- int x;
- cin >> x;
- a[i] = a[i - 1];
- a[i][x] = !a[i][x];
- }
- for (int i = 1; i <= m; i++)
- {
- int x;
- cin >> x;
- b[i] = b[i - 1];
- b[i][x] = !b[i][x];
- }
- for (int i = 1; i <= q; i++)
- {
- int l1, r1, l2, r2;
- cin >> l1 >> r1 >> l2 >> r2;
- pa = (a[r1] ^ a[l1 - 1]);
- pb = (b[r2] ^ b[l2 - 1]);
- res = (pa ^ pb);
- cout << res.count() << '\n';
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement