97372024-03-04 21:17:50anonLámpákcpp17Wrong answer 0/10054ms5792 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 & (1LL ^ (~(D[i] + K - 1) & D[i]));
        }
        cout << ans << '\n';
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted3ms1824 KiB
2Accepted3ms2028 KiB
subtask20/15
3Wrong answer3ms2112 KiB
4Accepted18ms2184 KiB
5Accepted50ms3700 KiB
subtask30/10
6Accepted3ms2444 KiB
7Wrong answer3ms2660 KiB
8Wrong answer3ms2752 KiB
9Wrong answer3ms2632 KiB
10Wrong answer3ms2860 KiB
subtask40/30
11Wrong answer14ms3220 KiB
12Wrong answer14ms3312 KiB
13Wrong answer14ms3308 KiB
14Accepted14ms3512 KiB
15Wrong answer14ms3728 KiB
16Wrong answer14ms3908 KiB
17Wrong answer14ms3992 KiB
subtask50/45
18Wrong answer45ms4148 KiB
19Wrong answer45ms4164 KiB
20Wrong answer45ms4112 KiB
21Wrong answer46ms4244 KiB
22Wrong answer45ms4232 KiB
23Wrong answer52ms5264 KiB
24Wrong answer52ms5264 KiB
25Wrong answer54ms5320 KiB
26Wrong answer54ms5640 KiB
27Wrong answer54ms5792 KiB
28Wrong answer41ms4496 KiB
29Wrong answer41ms4428 KiB