This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
int dp[101][101];
int main() {
cin.tie(0)->sync_with_stdio(0);
for (int k = 1; k <= 100; k++) {
for (int i = 0; i <= 100; i++) {
unordered_set<int> mex;
for (int j = 1; j <= min(i, k); j++)
mex.insert(dp[j][i - j]);
for (int j = 0; ; j++)
if (!mex.count(j)) {
dp[k][i] = j;
break;
}
}
}
int t;
cin >> t;
while (t--) {
int n, k;
cin >> n >> k;
ll nimber = 0;
for (int i = 1; i <= n; i++) {
ll sz;
cin >> sz;
if (k == 1) nimber ^= (sz & 1);
else nimber ^= dp[k][sz];
}
cout << (nimber != 0);
}
return 0;
}
# | 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... |