167172025-05-10 15:54:08TaxiradioLámpákcpp17Wrong answer 0/100123ms1572 KiB
// Source: https://usaco.guide/general/io

#include <bits/stdc++.h>
using namespace std;

int main() {
	int n , k , q; cin >> n >> k >> q;
    vector<int> a(1 , 0);
    for(int i = 1; i < n; i++){
        int y; cin >> y;
        a.push_back(a[y-1]+1);
    }
    vector<int> b(1 , 0);
    for(int i = 1; i < n; i++){
        int u = b.back() , c = k+i-1;
        while(c%2){
            c/=2;
            u++;
        }
        c = i;
        while(c%2){
            c/=2;
            u--;
        }
        b.push_back(u);
    }
    while(q--){
        int ans = 0;
        for(int i = 0; i < n; i++){
            int y; cin >> y;
            if(y && b[i]==0)ans++;
        }
        cout << ans%2 << "\n";
    }
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted1ms316 KiB
2Wrong answer1ms512 KiB
subtask20/15
3Wrong answer3ms316 KiB
4Wrong answer37ms316 KiB
5Wrong answer105ms1572 KiB
subtask30/10
6Wrong answer1ms316 KiB
7Wrong answer1ms500 KiB
8Wrong answer2ms316 KiB
9Wrong answer1ms316 KiB
10Wrong answer1ms316 KiB
subtask40/30
11Wrong answer43ms408 KiB
12Wrong answer41ms316 KiB
13Wrong answer41ms404 KiB
14Wrong answer43ms408 KiB
15Wrong answer41ms316 KiB
16Wrong answer43ms508 KiB
17Wrong answer41ms316 KiB
subtask50/45
18Wrong answer96ms564 KiB
19Wrong answer96ms824 KiB
20Wrong answer96ms808 KiB
21Wrong answer97ms660 KiB
22Wrong answer97ms744 KiB
23Wrong answer122ms1568 KiB
24Wrong answer123ms1452 KiB
25Wrong answer123ms1424 KiB
26Wrong answer122ms1400 KiB
27Wrong answer123ms1424 KiB
28Wrong answer89ms484 KiB
29Wrong answer89ms476 KiB