Submission #203396

#TimeUsernameProblemLanguageResultExecution timeMemory
2033960gnjenCombo (IOI18_combo)C++14
100 / 100
55 ms552 KiB
#include "combo.h" using namespace std; std::string guess_sequence(int N) { string ret = ""; string chs = "ABXY"; if( press("XY") ) { if(press("X"))ret = "X" , chs = "ABY"; else ret = "Y" , chs = "ABX"; } else { if(press("A"))ret = "A" , chs = "BXY"; else ret = "B" , chs ="AXY"; } for(int i = 1;i<N;i++) { if(i+1==N) { string ask1 = ret;ask1+=chs[0]; string ask2 = ret;ask2+=chs[1]; string ask3 = ret;ask3+=chs[2]; if(press(ask1) ==i+1 )ret = ask1; else if(press(ask2) ==i+1 )ret = ask2; else ret = ask3; } else { string ask1 = ret ; ask1+=chs[0]; ask1+=ret; ask1+=chs[1]; ask1+=chs[0]; ask1+=ret; ask1+=chs[1]; ask1+=chs[1]; ask1+=ret; ask1+=chs[1]; ask1+=chs[2]; int ans =press(ask1); if(ans==i)ret+=chs[2]; else if(ans==i+1)ret+=chs[0]; else ret+=chs[1]; } } return ret; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...