Submission #1114555

#TimeUsernameProblemLanguageResultExecution timeMemory
1114555lftroqCombo (IOI18_combo)C++14
5 / 100
1 ms504 KiB
#include "combo.h" using namespace std; string guess_sequence(int N) { string s=""; if(press("AB")) { if(press("A")) s.push_back('A'); else s.push_back('B'); } else { if(press("X")) s.push_back('X'); else s.push_back('Y'); } string can="ABXY"; if(s[0]=='A') can.erase(0,1); else if(s[0]=='B') can.erase(1,1); else if(s[0]=='X') can.erase(2,1); else can.erase(3,1); for(int i=1;i<N-1;i++) { string t=s; t.push_back(can[0]); t+=s; t.push_back(can[1]);t.push_back(can[0]); t+=s; t.push_back(can[1]);t.push_back(can[1]); t+=s; t.push_back(can[1]);t.push_back(can[2]); int c=press(t); if(c==i) s.push_back(can[2]); else if(c==i+1) s.push_back(can[0]); else s.push_back(can[1]); } s.push_back(can[0]); if(press(s)==N) return s; s.pop_back(); s.push_back(can[1]); if(press(s)==N) return s; s.pop_back(); s.push_back(can[2]); return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...