이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |