Submission #491839

#TimeUsernameProblemLanguageResultExecution timeMemory
491839n3rm1nFootball (info1cup20_football)C++17
26 / 100
10 ms2508 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; int a[11]; short used[4][4][4][4][4][4][4][4][4][4][4]; /// 0 - not used /// 1 - yes /// 2 - no void read() { for(int i=1; i<=n; i++) cin>>a[i]; } long long sum=0; void read2() { long long x; for(int i=1;i<=n;i++) { cin>>x; sum+=x; } } short wins(int s[11],int maxmove) { maxmove=min(maxmove,3); //cout<<s[1]<<" "<<s[2]<<" "<<s[3]<<" "<<s[4]<<" "<<s[5]<<" "<<s[6]<<" "<<s[7]<<" "<<s[8]<<" "<<s[9]<<" "<<s[10]<<", moves: "<<maxmove<<": "<<used[s[1]][s[2]][s[3]][s[4]][s[5]][s[6]][s[7]][s[8]][s[9]][s[10]][maxmove]<<endl; if(used[s[1]][s[2]][s[3]][s[4]][s[5]][s[6]][s[7]][s[8]][s[9]][s[10]][maxmove]!=0) { //cout<<s[1]<<" "<<s[2]<<" "<<s[3]<<" "<<s[4]<<" "<<s[5]<<" "<<s[6]<<" "<<s[7]<<" "<<s[8]<<" "<<s[9]<<" "<<s[10]<<", moves: "<<maxmove<<": "<<used[s[1]][s[2]][s[3]][s[4]][s[5]][s[6]][s[7]][s[8]][s[9]][s[10]][maxmove]<<endl; return used[s[1]][s[2]][s[3]][s[4]][s[5]][s[6]][s[7]][s[8]][s[9]][s[10]][maxmove]; } bool emptyy=true; for(int i=1; i<=n; i++) { if(s[i]!=0)emptyy=false; } if(emptyy==true) { used[0][0][0][0][0][0][0][0][0][0][maxmove]=2; return 2; } for(int i=1; i<=n; i++) { int old=s[i]; for(int take=1; take<=min(s[i],maxmove); take++) { s[i]-=take; if(wins(s,take)==2) { s[i]=old; used[s[1]][s[2]][s[3]][s[4]][s[5]][s[6]][s[7]][s[8]][s[9]][s[10]][maxmove]=1; return used[s[1]][s[2]][s[3]][s[4]][s[5]][s[6]][s[7]][s[8]][s[9]][s[10]][maxmove]; } s[i]=old; } } used[s[1]][s[2]][s[3]][s[4]][s[5]][s[6]][s[7]][s[8]][s[9]][s[10]][maxmove,3]=2; return used[s[1]][s[2]][s[3]][s[4]][s[5]][s[6]][s[7]][s[8]][s[9]][s[10]][maxmove,3]; } int main() { speed(); int t; cin>>t; while(t--) { cin>>n>>k; if(k==1) { sum=0; read2(); cout<<sum%2; } else { read(); if(wins(a,k)==1)cout<<1; else cout<<0; } } cout<<endl; return 0; }

Compilation message (stderr)

football.cpp: In function 'short int wins(int*, int)':
football.cpp:66:71: warning: left operand of comma operator has no effect [-Wunused-value]
   66 |     used[s[1]][s[2]][s[3]][s[4]][s[5]][s[6]][s[7]][s[8]][s[9]][s[10]][maxmove,3]=2;
      |                                                                       ^~~~~~~
football.cpp:67:78: warning: left operand of comma operator has no effect [-Wunused-value]
   67 |     return used[s[1]][s[2]][s[3]][s[4]][s[5]][s[6]][s[7]][s[8]][s[9]][s[10]][maxmove,3];
      |                                                                              ^~~~~~~
#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...