# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
525024 | maks007 | Football (info1cup20_football) | C++14 | 198 ms | 1128 KiB |
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>
using namespace std;
#define int long long
int32_t main(void) {
int t;
cin >> t;
int countdown = 0;
while(t --){
int n, k;
cin >> n >> k;
vector <int> a(n);
for(int i = 0; i < n; i ++) cin >> a[i];
if(n == 1) {
if(k >= a[0]) {
cout << 1;
continue;
}
if(a[0] % 2 == 1) {
cout << 1;
continue;
}
n = a[0];
int mx = 1;
while(n % 2 == 0) {
n /= 2;
mx *= 2;
}
if(k >= mx and n > 1) {
cout << 1;
}else cout << 0;
continue;
}
if(k == 1) {
int sum = accumulate(a.begin(), a.end(), 0ll);
if(sum % 2 == 1) {
cout << 1;
}else cout << 0;
continue;
}else if(*max_element(a.begin(), a.end()) == 2) {
int sum = 0;
for(int i = 0; i < a.size(); i ++) {
if(a[i] % 2 == 1) sum += 1;
}
int move = 0;
for(int i = 0; i < a.size(); i ++) {
move += (int)(a[i] / 2);
}
if(move % 2 == 0) {
if(sum % 2 == 1) {
cout << 1;
}else cout << 0;
}else {
if(sum % 2 == 0) cout << 1;
else cout << 0;
}
}else if(k == 2) {
int sum = accumulate(a.begin(), a.end(), 0ll);
if(sum % 2 == 1) {
cout << 1;
continue;
}
int even = 0, odd = 0;
for(int i = 0; i < a.size(); i ++) {
if(a[i] % 2 == 1) odd ++;
else even += a[i];
}
if(even%4 == 0) {
if(odd % 2 == 0) cout << 1;
else cout << 0;
}else {
if(odd % 2 == 0) cout << 0;
else cout << 1;
}
continue;
}
}
return false;
}
Compilation message (stderr)
# | 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... |