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;
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... |