Submission #101607

#TimeUsernameProblemLanguageResultExecution timeMemory
101607daniel920712Combo (IOI18_combo)C++14
100 / 100
59 ms560 KiB
#include <string> #include <stdio.h> #include <iostream> #include "combo.h" using namespace std; string all; string aaa; bool have[4]={0}; bool can[5][2005]={0}; char change1[4][4]={"A","B","X","Y"}; char change[4]={'A','B','X','Y'}; string guess_sequence(int N) { int con=0,i,j,k,t,x=0,a,b,c; for(i=0;i<N;i++) { if(i==0) { t=press("AB"); if(t) { if(t==2) { all+="AB"; i++; } else { t=press("A"); if(t) { all+='A'; can[1][1]=1; } else all+='B'; } } else { t=press("X"); if(t) all+='X'; else all+='Y'; } continue; } if(i==N-1) { con=0; for(j=0;j<4;j++) { if(change[j]==all[0]) continue; if(con==2) all+=change[j]; else if(press(all+change[j])==i+1) { all+=change[j]; break; } con++; } continue; } a=-1; b=-1; c=-1; for(j=0;j<4;j++) { if(change[j]!=all[0]) { if(a==-1) a=j; else if(b==-1) b=j; else if(c==-1) c=j; } } t=press(all+change[a]+all+change[b]+change[a]+all+change[b]+change[b]+all+change[b]+change[c]); if(t==i) all+=change[c]; else if(t==i+1) all+=change[a]; else all+=change[b]; } return all; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:14:19: warning: unused variable 'k' [-Wunused-variable]
   14 |     int con=0,i,j,k,t,x=0,a,b,c;
      |                   ^
combo.cpp:14:23: warning: unused variable 'x' [-Wunused-variable]
   14 |     int con=0,i,j,k,t,x=0,a,b,c;
      |                       ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...