Submission #991843

#TimeUsernameProblemLanguageResultExecution timeMemory
991843phoenixCombo (IOI18_combo)C++17
100 / 100
35 ms1804 KiB
#include "combo.h" using namespace std; string guess_sequence(int N) { string S; if (press("AB")) { if (press("A")) S += 'A'; else S += 'B'; } else { if (press("X")) S += 'X'; else S += 'Y'; } string t = "ABXY"; t.erase(t.find(S[0]), 1); for (int i = 1; i < N - 1; i++) { string p = ""; p += S + t[0]; p += S + t[1] + t[0]; p += S + t[1] + t[1]; p += S + t[1] + t[2]; int x = press(p) - (int)S.size(); if (x == 0) S += t[2]; if (x == 1) S += t[0]; if (x == 2) S += t[1]; } if ((int)S.size() < N) { if (press(S + t[0] + S + t[1]) == N) { if (press(S + t[0]) == N) S += t[0]; else S += t[1]; } else { S += t[2]; } } return S; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...