Submission #98311

#TimeUsernameProblemLanguageResultExecution timeMemory
98311fefeCombo (IOI18_combo)C++17
100 / 100
46 ms568 KiB
#include "combo.h" #include<bits/stdc++.h> using namespace std; string ans=""; string S = ""; char ch[4]={'A','B','X','Y'}; std::string guess_sequence(int N) { int i,x; S+=ch[0],S+=ch[1];x=press(S);S.clear(),S.resize(0); if(x){S+=ch[0];x=press(S)?0:1;} else{S+=ch[2];x=press(S)?2:3;} int y; int j,k,l; ans+=ch[x]; if(N==1) return ans; for(i=1;i<N-1;i++){ S.clear();S.resize(0); y=0; for(j=0;j<4;j++){ if(j==x) continue; y++; if(y==1) continue; if(y==2){ S+=ans,S+=ch[j]; } if(y==3){ for(k=0;k<4;k++){ if(k!=x){S+=ans,S+=ch[j],S+=ch[k];} } } } int z=press(S)-i; y=0; for(j=0;j<4;j++){ if(j==x) continue; if(y==z){ ans+=ch[j]; break; }y++; } } S.clear();S.resize(0); S+=ans,S+=ch[0],S+=ans,S+=ch[1];x=press(S);S.clear(),S.resize(0); if(x==N){S+=ans,S+=ch[0];x=press(S)==N?0:1;} else{S+=ans,S+=ch[2];x=press(S)==N?2:3;} ans+=ch[x]; return ans; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:13:10: warning: unused variable 'l' [-Wunused-variable]
   13 |  int j,k,l;
      |          ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...