167162025-05-10 15:51:59TaxiradioLámpákcpp17Wrong answer 0/100128ms1556 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 = 0 , 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 answer1ms364 KiB
subtask20/15
3Wrong answer3ms316 KiB
4Wrong answer39ms560 KiB
5Wrong answer111ms1404 KiB
subtask30/10
6Wrong answer1ms316 KiB
7Wrong answer1ms316 KiB
8Wrong answer2ms316 KiB
9Wrong answer1ms316 KiB
10Wrong answer1ms532 KiB
subtask40/30
11Accepted43ms412 KiB
12Wrong answer43ms404 KiB
13Wrong answer43ms420 KiB
14Wrong answer43ms404 KiB
15Wrong answer43ms316 KiB
16Wrong answer45ms316 KiB
17Wrong answer43ms316 KiB
subtask50/45
18Wrong answer101ms564 KiB
19Wrong answer100ms736 KiB
20Wrong answer100ms568 KiB
21Wrong answer100ms564 KiB
22Wrong answer101ms564 KiB
23Wrong answer125ms1420 KiB
24Wrong answer126ms1452 KiB
25Wrong answer128ms1556 KiB
26Wrong answer126ms1452 KiB
27Wrong answer126ms1444 KiB
28Wrong answer92ms476 KiB
29Wrong answer96ms480 KiB