Submission #328973

#TimeUsernameProblemLanguageResultExecution timeMemory
328973ThaiBaHungFootball (info1cup20_football)C++14
100 / 100
42 ms2156 KiB
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 3; int test; int n, k; int a[N]; long long sum = 0; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> test; while (test--) { cin >> n >> k; sum = 0; for (int i = 1; i <= n; i++) cin >> a[i], sum += a[i]; if (sum % 2) { cout << 1; continue; } if (k == 1) { cout << 0; continue; } long long cur = 0; int res = 0; for (int j = 1; (1 << j) <= k; j++) { for (int i = 1; i <= n; i++) { cur = cur + a[i] / (1 << j); } if (cur % 2) { res = 1; break; } } cout << res; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...