Submission #82720

#TimeUsernameProblemLanguageResultExecution timeMemory
82720arman_ferdousCombo (IOI18_combo)C++17
100 / 100
52 ms556 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; std::string guess_sequence(int N) { string s = ""; string t = "ABXY"; if(press("AB")) { if(press("A")) { t.erase(t.begin()); s += "A"; } else { t.erase(t.begin()+1); s += "B"; } } else { if(press("X")) { t.erase(t.begin()+2); s += "X"; } else { t.erase(t.begin()+3); s += "Y"; } } if(N == 1) return s; for(int i = 1; i + 1 < N; i++) { int res = press(s + t[0] + t[0] + s + t[0] + t[1] + s + t[0] + t[2] + s + t[1]); if(res == i + 2) s += t[0]; else if(res == i + 1) s += t[1]; else s += t[2]; } if(press(s + t[0] + s + t[1]) == N) { if(press(s + t[0]) == N) return s + t[0]; return s + t[1]; } return s + t[2]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...