이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(a,b) for (int a = 0; a < (b); ++a)
#define pb push_back
#define all(t) t.begin(), t.end()
const int max_N = 1e5+5;
int t = 0, n = 0, k = 0;
ll s = 0;
int A[max_N];
int main()
{
// Jak suma nieparzysta to odrazu win, jak nie to dla jakies dowolnej potegi dwojki suma A[i]/2^x musi byc nieparzysta, wtedy sie da
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> t;
while(t--)
{
cin >> n >> k;
rep(i,n) cin >> A[i];
s = 0;
rep(i,n) s += A[i];
if (s % 2 == 1)
{
cout << '1';
continue;
}
int ilo = 1;
bool czy_OK = false;
while(ilo <= k)
{
ll sum = 0;
rep(i,n) sum += A[i] / ilo;
if (sum % 2 == 1)
{
czy_OK = true;
break;
}
ilo *= 2;
}
if (czy_OK == true) cout << '1';
else cout << '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... |