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 <iostream>
#include <map>
#include <vector>
using namespace std;
int v[100005];
void testcase() {
int n, k;
cin >> n >> k;
if(n == 1) {
if(n % 2 == 1 || k >= n || (k > 1 && n % 4 == 0)) {
cout << 1;
} else {
cout << 0;
}
return;
}
int x = 0;
for(int i = 1; i <= n; i ++) {
int a;
cin >> a;
x += a;
if(x > 1e9) {
x %= 2;
}
}
cout << x % 2;
}
int main() {
int tests;
cin >> tests;
for(int i = 1; i <= tests; i ++) {
testcase();
}
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... |