#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define pii pair<int, int>
#define fi first
#define se second
const int maxn = 1e5;
int n, k, q;
int par[1 + maxn];
int getans() {
int init, oneabove, cnt;
cin >> init >> oneabove;
cnt = 0;
for(int i = 3; i <= n; i++) {
int x;
cin >> x;
cnt += x;
}
cnt %= 2;
int curk = k % 4;
while(curk > 0) {
curk--;
init ^= cnt;
init ^= oneabove;
oneabove ^= cnt;
}
int res = init;
return res;
}
void solve() {
cin >> n >> k >> q;
for(int i = 2; i <= n; i++) {
cin >> par[i];
}
for(int qi = 1; qi <= q; qi++) {
cout << (int) getans() << "\n";
}
}
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
solve();
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 2032 KiB | ||||
2 | Wrong answer | 3ms | 2172 KiB | ||||
subtask2 | 15/15 | ||||||
3 | Accepted | 4ms | 2544 KiB | ||||
4 | Accepted | 18ms | 3296 KiB | ||||
5 | Accepted | 50ms | 5036 KiB | ||||
subtask3 | 0/10 | ||||||
6 | Accepted | 3ms | 4180 KiB | ||||
7 | Wrong answer | 3ms | 4356 KiB | ||||
8 | Wrong answer | 3ms | 4372 KiB | ||||
9 | Wrong answer | 3ms | 4632 KiB | ||||
10 | Wrong answer | 3ms | 4596 KiB | ||||
subtask4 | 0/30 | ||||||
11 | Accepted | 14ms | 4864 KiB | ||||
12 | Wrong answer | 14ms | 5420 KiB | ||||
13 | Wrong answer | 14ms | 5744 KiB | ||||
14 | Wrong answer | 14ms | 5924 KiB | ||||
15 | Wrong answer | 14ms | 6484 KiB | ||||
16 | Wrong answer | 14ms | 6740 KiB | ||||
17 | Wrong answer | 14ms | 7068 KiB | ||||
subtask5 | 0/45 | ||||||
18 | Wrong answer | 45ms | 8320 KiB | ||||
19 | Wrong answer | 45ms | 9424 KiB | ||||
20 | Wrong answer | 45ms | 10560 KiB | ||||
21 | Wrong answer | 45ms | 11648 KiB | ||||
22 | Wrong answer | 45ms | 13020 KiB | ||||
23 | Wrong answer | 54ms | 15152 KiB | ||||
24 | Wrong answer | 54ms | 16936 KiB | ||||
25 | Wrong answer | 54ms | 18436 KiB | ||||
26 | Wrong answer | 54ms | 19992 KiB | ||||
27 | Wrong answer | 54ms | 21540 KiB | ||||
28 | Wrong answer | 41ms | 21836 KiB | ||||
29 | Wrong answer | 41ms | 22980 KiB |