이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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);
function <int()> check=[&]() {
int cnt = 0;
for(int i = 0; i < n; i++) {
if(a[i] == 1 or a[i] == 0) cnt ++;
}
if(cnt == n) return 0;
else return 1;
};
for(int i = 0; i < n; i ++) cin >> a[i];
// int sum = accumulate(a.begin(), a.end(), 0ll);
// if(sum % 2 == 1) {
// cout << 1;
// continue;
// }
// if(k == 1) {
// cout << 0;
// continue;
// }
// int move = 0;
// while(true){
// if(!check()) {
// cout << move;
// goto end;
// }
// move = 1 - move;
// for(int i = 0 ; i < n; i ++) {
// if(a[i] > 1) {
// a[i] --;
// a[i] --;
// break;
// }
// }
// }
// cout << 1-move;
// end:; {
a[0] = accumulate(a.begin(), a.end(), 0ll);
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()) <= 3) {
// 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 += a[i];
// else even += a[i];
// }
// continue;
// }
}
return false;
}
컴파일 시 표준 에러 (stderr) 메시지
football.cpp: In function 'int32_t main()':
football.cpp:8:6: warning: unused variable 'countdown' [-Wunused-variable]
8 | int countdown = 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... |