103992024-04-01 19:38:36Valaki2Lámpákcpp17Wrong answer 15/10054ms22980 KiB
#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();
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted3ms2032 KiB
2Wrong answer3ms2172 KiB
subtask215/15
3Accepted4ms2544 KiB
4Accepted18ms3296 KiB
5Accepted50ms5036 KiB
subtask30/10
6Accepted3ms4180 KiB
7Wrong answer3ms4356 KiB
8Wrong answer3ms4372 KiB
9Wrong answer3ms4632 KiB
10Wrong answer3ms4596 KiB
subtask40/30
11Accepted14ms4864 KiB
12Wrong answer14ms5420 KiB
13Wrong answer14ms5744 KiB
14Wrong answer14ms5924 KiB
15Wrong answer14ms6484 KiB
16Wrong answer14ms6740 KiB
17Wrong answer14ms7068 KiB
subtask50/45
18Wrong answer45ms8320 KiB
19Wrong answer45ms9424 KiB
20Wrong answer45ms10560 KiB
21Wrong answer45ms11648 KiB
22Wrong answer45ms13020 KiB
23Wrong answer54ms15152 KiB
24Wrong answer54ms16936 KiB
25Wrong answer54ms18436 KiB
26Wrong answer54ms19992 KiB
27Wrong answer54ms21540 KiB
28Wrong answer41ms21836 KiB
29Wrong answer41ms22980 KiB