97362024-03-04 21:15:51anonLámpákcpp17Wrong answer 0/10056ms23532 KiB
#include <bits/stdc++.h>
#define FastIO ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
using namespace std;
typedef long long ll;
int main() {
    FastIO;
    ll i, ans, N, K, Q, P, S;
    cin >> N >> K >> Q;
    vector<ll> D(N + 1);
    D[1] = 0;
    for(i = 2; i <= N; i++) {
        cin >> P;
        D[i] = D[P] + 1;
    }
    while(Q--) {
        cin >> ans;
        for(i = 2; i <= N; i++) {
            cin >> S;
            ans ^= S & ((D[i] + K - 1) & (K - 1));
        }
        cout << ans << '\n';
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted3ms1828 KiB
2Accepted3ms2060 KiB
subtask20/15
3Wrong answer3ms2152 KiB
4Wrong answer19ms3032 KiB
5Accepted50ms5616 KiB
subtask30/10
6Wrong answer3ms4340 KiB
7Wrong answer3ms4684 KiB
8Wrong answer3ms4600 KiB
9Wrong answer3ms4684 KiB
10Wrong answer3ms4952 KiB
subtask40/30
11Wrong answer14ms5192 KiB
12Wrong answer14ms5760 KiB
13Wrong answer14ms6084 KiB
14Accepted16ms6668 KiB
15Wrong answer14ms6932 KiB
16Wrong answer16ms7408 KiB
17Wrong answer14ms7884 KiB
subtask50/45
18Wrong answer46ms9156 KiB
19Wrong answer46ms10232 KiB
20Wrong answer46ms11280 KiB
21Wrong answer46ms12396 KiB
22Wrong answer46ms13788 KiB
23Wrong answer54ms16340 KiB
24Wrong answer54ms17864 KiB
25Wrong answer56ms19720 KiB
26Wrong answer54ms21244 KiB
27Wrong answer54ms22800 KiB
28Wrong answer41ms22544 KiB
29Wrong answer41ms23532 KiB