Submission #109430

#TimeUsernameProblemLanguageResultExecution timeMemory
109430eu3neuomCombo (IOI18_combo)C++17
100 / 100
52 ms552 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; std::string guess_sequence(int N) { string S = ""; int coins = press("AB"); if (coins == 2) { S = "A"; } else if (coins == 1) { if (press("A") == 1) { S = "A"; } else { S = "B"; } } else { if (press("X") == 1) { S = "X"; } else { S = "Y"; } } if (N == 1) return S; vector < char > pos = {'A', 'B', 'X', 'Y'}; for (int i = 0; i < 4; ++i) { if (S[0] == pos[i]) { pos.erase(pos.begin() + i); break; } } for (int i = 1; i < N - 1; ++i) { string Q = S + pos[0] + S + pos[1] + pos[0] + S + pos[1] + pos[1] + S + pos[1] + pos[2]; int coins = press(Q); if (coins == i) { S += pos[2]; } else if (coins == (i + 1)) { S += pos[0]; } else { S += pos[1]; } } if (press(S + pos[0] + S + pos[1]) == N) { if (press(S + pos[0]) == N) { S += pos[0]; } else { S += pos[1]; } } else { S += pos[2]; } return S; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...