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>
#include <iostream>
#include <numeric>
using namespace std;
int main() {
int T;
cin >> T;
for (int t = 0; t < T; t++) {
long N, K;
cin >> N >> K;
vector<long> classes(N, 0);
for (int i = 0; i < N; i++) {
cin >> classes[i];
}
const long S = accumulate(classes.begin(), classes.end(), 0);
if (S % 2 == 1) {
cout << 1;
continue;
}
long overtwos = 0;
for (long i : classes) {
if (i >= 2)
overtwos++;
}
if(K==1){
cout << 0;
continue;}
if (overtwos % 2 == 1) {
cout << 1;
continue;
}
cout << 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... |