Submission #492534

#TimeUsernameProblemLanguageResultExecution timeMemory
492534n3rm1nFootball (info1cup20_football)C++17
0 / 100
21 ms980 KiB
#include<bits/stdc++.h> #define endl '\n' using namespace std; const int MAXN=1e5+10; void speed() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); } int n,k; long long sum=0; void readFS() { long long x; for(int i=1; i<=n; i++) { cin>>x; sum+=x; } } int a[11]; int d[11][11][11][11][11][11]; /// 0 - not used /// 1 - yes /// 2 - no int cnt[6]; void read() { memset(cnt,0,sizeof(cnt)); for(int i=1; i<=n; i++) { cin>>a[i]; cnt[a[i]]++; } } int wins(int classes[6],int maxtake) { maxtake=min(maxtake,5); ///cout<<classes[1]<<" "<<classes[2]<<" "<<classes[3]<<" "<<classes[4]<<" "<<classes[5]<<" "<<maxtake<<": "<<d[classes[1]][classes[2]][classes[3]][classes[4]][classes[5]][maxtake]<<endl; if(d[classes[1]][classes[2]][classes[3]][classes[4]][classes[5]][maxtake]!=0) return d[classes[1]][classes[2]][classes[3]][classes[4]][classes[5]][maxtake]; for(int i=1; i<=5; i++) { if(classes[i]>=1) { for(int j=1; j<=min(i,maxtake); j++) { classes[i]--; classes[i-j]++; if(wins(classes,j)==2) { classes[i]++; classes[i-j]--; d[classes[1]][classes[2]][classes[3]][classes[4]][classes[5]][maxtake]=1; ///cout<<classes[1]<<" "<<classes[2]<<" "<<classes[3]<<" "<<classes[4]<<" "<<classes[5]<<" "<<maxtake<<": "<<d[classes[1]][classes[2]][classes[3]][classes[4]][classes[5]][maxtake]<<endl; return d[classes[1]][classes[2]][classes[3]][classes[4]][classes[5]][maxtake]; } else { classes[i]++; classes[i-j]--; } } } } d[classes[1]][classes[2]][classes[3]][classes[4]][classes[5]][maxtake]=2; //cout<<classes[1]<<" "<<classes[2]<<" "<<classes[3]<<" "<<classes[4]<<" "<<classes[5]<<" "<<maxtake<<": "<<d[classes[1]][classes[2]][classes[3]][classes[4]][classes[5]][maxtake]<<endl; return d[classes[1]][classes[2]][classes[3]][classes[4]][classes[5]][maxtake]; } bool winn() { long long x=a[1]; for(int i=2;i<=n;i++) { x=(x ^ a[i]); } return (x!=0); } int main() { speed(); int t; cin>>t; while(t--) { cin>>n>>k; read(); if(winn()==true)cout<<1; else cout<<0; } 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...