Submission #914729

#TimeUsernameProblemLanguageResultExecution timeMemory
914729NValchanovFootball (info1cup20_football)C++17
100 / 100
26 ms2140 KiB
#include<bits/stdc++.h> #define endl '\n' using namespace std; typedef long long ll; const ll MAXN=1e5+10; ll a[MAXN],n,k,sum; void solve() { while(sum>0&&k>0) { if(k==1) { cout<<sum%2; return; } if(sum%2==1) { cout<<1; return; } k/=2; sum=0; for(ll i=1;i<=n;i++) { a[i]/=2; sum+=a[i]; } if(k==1) { cout<<sum%2; return; } if(sum%2==1) { cout<<1; return; } } cout<<0; } void read() { cin>>n>>k; sum=0; for(ll i=1;i<=n;i++) { cin>>a[i]; sum+=a[i]; } } int main() { #ifdef ONLINE_JUDGE freopen(".in", "r", stdin); freopen(".out", "w", stdout); #endif ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); ll t; cin>>t; while(t--) { read(); solve(); } cout<<endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...