# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
932998 | amin_2008 | Football (info1cup20_football) | C++17 | 0 ms | 0 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.
// #pragma GCC optimize ("O3")
// #pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx,avx2,fma")
#include <iostream>
#include <algorithm>
#include <fstream>
#include <cstdio>
#include <queue>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <map>
#include <cassert>
#include <unordered_map>
#include <set>
#include <stack>
#include <cstring>
#include <cmath>
#include <bitset>
#include <random>
#include <numeric>
#include <cstdlib>
// #include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// author: amin
typedef long long ll;
#define pb push_back
#define ins insert
#define ts to_string
#define sz(x) (int)(x).size()
#define mp make_pair
#define F first
#define S second
#define bpc __builtin_popcount
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define lb lower_bound
#define ub upper_bound
#define ld long double
#define endl '\n'
#define int ll
using namespace std;
// using namespace __gnu_pbds;
// using namespace __cxx11;
using pii = pair<int, int>;
using vi = vector<int>;
using vs = vector<string>;
using vpii = vector<pii>;
using vb = vector<bool>;
using vc = vector<char>;
using vvi = vector<vi>;
// template <typename T>
// using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define debug(x) cerr << (#x) << ": " << x << endl
const int MOD = 998244353;
const int mod = 1e9 + 7;
const int inf = 1e18;
const int sz = 10e5 + 5;
const int N = 1005;
const int lg = 18;
const int P = 31;
int a[sz];
void solve()
{
int n, k;
cin >> n >> k;
int sum = 0;
for(int i = 1; i <= n; i++) cin >> a[i], sum += a[i];
if ( sum & 1 )
{
cout << 1;
return;
}
for(int i = 2; i <= k; i <<= 1)
{
int cnt = 0;
for(int j = 1; j <= n; j++) cnt += a[j] / i;
if ( cnt & 1 )
{
cout << 1;
return;
}
}
cout << 0;
}
signed main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t = 1;
cin >> t;
for(int i = 1; i <= t; i++) solve();
}