Submission #770725

#TimeUsernameProblemLanguageResultExecution timeMemory
770725AtinaRCombo (IOI18_combo)C++14
5 / 100
1 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 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'; } 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:73:9: warning: unused variable 'tmp' [-Wunused-variable]
   73 |     int tmp;
      |         ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...