Submission #770726

#TimeUsernameProblemLanguageResultExecution timeMemory
770726AtinaRCombo (IOI18_combo)C++14
100 / 100
25 ms516 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; std::string guess_sequence(int N) { char first; int f=press("AB"); if(f>=1) { f=press("A"); if(f>=1) { first='A'; } else { first='B'; } } else { f=press("X"); if(f>=1) { first='X'; } else first='Y'; } string res=""; res+=first; char a,b,c; if(first=='X') { a='A'; b='B'; c='Y'; } else if(first=='Y') { a='A'; b='B'; c='X'; } else if(first=='A') { a='X'; b='B'; c='Y'; } else if(first=='B') { a='A'; b='X'; c='Y'; } if(N==1) return res; for(int sz=1; sz<N-1; sz++) { string cnt=res+a+ res+b+a + res+b+b + res+b+c; int tmp=press(cnt); if(tmp==sz+1) { res+=a; } else if(tmp==sz+2) { res+=b; } else if(tmp==sz) { res+=c; } } int tmp; if(press(res+a)==N) { res+=a; } else if(press(res+b)==N) { res+=b; } else { res+=c; } return res; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:75:9: warning: unused variable 'tmp' [-Wunused-variable]
   75 |     int tmp;
      |         ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...