Submission #770718

#TimeUsernameProblemLanguageResultExecution timeMemory
770718AtinaRCombo (IOI18_combo)C++14
0 / 100
0 ms208 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 possible[3]; if(first=='X') { possible[0]='A'; possible[1]='B'; possible[2]='Y'; } else if(first=='Y') { possible[0]='A'; possible[1]='B'; possible[2]='X'; } else if(first=='A') { possible[0]='X'; possible[1]='B'; possible[2]='Y'; } else if(first=='B') { possible[0]='A'; possible[1]='X'; possible[2]='Y'; } while((int)res.size()<N-1) { string cnt=res+possible[0]+ res+possible[1]+possible[0] + res+possible[1]+possible[1] + res+possible[1]+possible[2]; int tmp=press(cnt); if(tmp==1) { res+=possible[0]; } else if(tmp>=2) { res+=possible[1]; } else if(tmp==0) { res+=possible[2]; } } int tmp; if(press(res+possible[0])==N) { res+=possible[0]; } else if(press(res+possible[1])==N) { res+=possible[1]; } else { res+=possible[2]; } return res; }

Compilation message (stderr)

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