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("Ofast,unroll-loops")
//#pragma GCC target("avx2,fma,bmi,bmi2,sse4.2,popcnt,lzcnt")
#include <bits/stdc++.h>
#define int long long
#define ll long long
#define vll vector<ll>
#define vllp vector<pair<ll, ll> >
#define vi vector <int>
#define vip vector <pair <int, int> >
#define db double
#define ldb long double
#define pdb pair <double, double>
#define YES cout<<"Yes"
#define NO cout<<"No"
#define nl cout<<"\n"
#define vv vector <vector <ll> >
#define pll pair <ll, ll>
#define pi pair <int, int>
#define pb push_back
#define f first
#define s second
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const ll mod=1e9+7;
const ll modx=998244353;
const double eps=1e-9;
const ll INF=2e9;
const ll INFINF=9e18;
const int N=1e5;
int n, k, a[N+5];
void input()
{
cin >> n >> k;
for(int i = 1; i <= n; i++) cin >> a[i];
}
void solve()
{
int cur=1;
while(cur<=k)
{
int cnt=0;
for(int i = 1; i <= n; i++) cnt+=a[i];
if(cnt%2)
{
cout << 1;
return;
}
cur*=2;
for(int i = 1; i <= n; i++) a[i]/=2;
}
cout << 0;
}
signed main()
{
// auto start_time = chrono::high_resolution_clock::now();
// #ifdef ONLINE_JUDGE
// freopen("f.in", "r", stdin);
// #endif
// freopen("f.in", "r", stdin);
// freopen("kek.out", "w", stdout);
ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
int t=1;
cin >> t;
for(int i = 1; i <= t; i++)
{
input();
solve();
}
// auto end_time = chrono::high_resolution_clock::now();
// double duration = chrono::duration_cast<chrono::milliseconds>(end_time - start_time).count();
// cout << "\n[ " << duration << " ms ]\n";
}
# | 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... |