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>
// author : aykhn
using namespace std;
typedef long long ll;
#define pb push_back
#define ins insert
#define mpr make_pair
#define all(v) v.begin(), v.end()
#define bpc __builtin_popcount
#define bpcll __builtin_popcountll
#define pii pair<int, int>
#define pll pair<ll, ll>
#define fi first
#define se second
#define infll 0x3F3F3F3F3F3F3F3F
#define inf 0x3F3F3F3F
const int MXN = 1e5 + 5;
const int LOG = 19;
signed main()
{
ios_base::sync_with_stdio(0);
cin.tie(nullptr);
int t;
cin >> t;
while (t--)
{
int n, k;
cin >> n >> k;
int ok = 1;
int sum = 0;
for (int i = 0; i < n; i++)
{
int x;
cin >> x;
sum += x;
ok &= (x == 1);
}
ok |= (k == 1);
if (ok) cout << sum % 2;
else cout << 1;
}
}
# | 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... |