제출 #715436

#제출 시각아이디문제언어결과실행 시간메모리
715436MilosMilutinovicFootball (info1cup20_football)C++14
100 / 100
43 ms2004 KiB
#include <bits/stdc++.h> using i64 = long long; void solve() { int n, k; std::cin >> n >> k; std::vector<int> a(n); for (int i = 0; i < n; i++) { std::cin >> a[i]; } int pw = 1; while (pw * 2 <= k) { pw *= 2; } k = pw; i64 s = 0; for (int i = 0; i < n; i++) { s += a[i]; } if (s % 2 == 1) { std::cout << "1"; return; } std::function<int(int, int)> dfs = [&](int x, int v) { if (x > k) { return 0; } int t = v; for (int i = 0; i < n; i++) { t ^= (a[i] % 2); } if (t == 1) { return 1; } for (int i = 0; i < n; i++) { a[i] /= 2; } return dfs(x * 2, t); }; std::cout << dfs(1, 0); } int main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); int t; std::cin >> t; while (t--) { solve(); } return 0; }
#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...