Submission #339170

#TimeUsernameProblemLanguageResultExecution timeMemory
339170cheissmartFootball (info1cup20_football)C++14
100 / 100
46 ms1388 KiB
#include <bits/stdc++.h> #define IO_OP std::ios::sync_with_stdio(0); std::cin.tie(0); #define F first #define S second #define V vector #define PB push_back #define MP make_pair #define EB emplace_back #define ALL(v) (v).begin(), (v).end() #define debug(x) cerr << "Line(" << __LINE__ << ") -> " << #x << " is " << x << endl using namespace std; typedef long long ll; typedef pair<int, int> pi; typedef V<int> vi; const int INF = 1e9 + 7; signed main() { IO_OP; int t; cin >> t; while(t--) { int n, k; cin >> n >> k; vi x(n); for(int i = 0; i < n; i++) cin >> x[i]; bool ans = 0; while(true) { int tt = 0; for(int i = 0; i < n; i++) tt ^= x[i] & 1; if(tt == 1) { ans = 1; break; } if(k == 1) break; k /= 2; for(int i = 0; i < n; i++) x[i] /= 2; } cout << ans; /*if(k == 1) { int sg = 0; for(int i = 0; i < n; i++) { int x; cin >> x; sg ^= x & 1; } if(sg) cout << 1; else cout << 0; } else if(n == 1) { int x; cin >> x; function<bool(int, int)> win = [&] (int x, int k) -> bool { if(x & 1) return 1; if(k == 1) return 0; x /= 2; k /= 2; return win(x, k); }; cout << win(x, k); } else if(k == 2) { vi x(n); int sg = 0; for(int i = 0; i < n; i++) { cin >> x[i]; sg ^= x[i] & 1; } if(sg) cout << 1; else { int tt = 0; for(int i = 0; i < n; i++) tt ^= (x[i] / 2) & 1; cout << tt; } }*/ } cout << endl; }
#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...