Submission #1238997

#TimeUsernameProblemLanguageResultExecution timeMemory
1238997TimoshCombo (IOI18_combo)C++20
5 / 100
0 ms408 KiB
#include "bits/stdc++.h" #include "combo.h" using namespace std; string guess_sequence(int N) { string S, s = "ABXY"; if (press("AB")) { if (press("A")) S = "A"; else S = "B"; } else { if (press("X")) S = "X"; else S = "Y"; } int j = 0; while (S[0] != s[j]) j++; s.erase(s.begin() + j); string a, b, c, d; a += s[0]; b += s[1]; c += s[1]; d += s[1]; b += s[0]; c += s[1]; d += s[2]; while (S.size() < N - 1) { string T = (S + a) + (S + b) + (S + c) + (S + d); // cout << T; int x = press(T); if (x == S.size()) S += s[2]; else if (x == S.size() + 1) S += s[0]; else S += s[1]; } if (press(S + a) == N) return S + a; else if (press(S + (s[1])) == N) return S + (s[1]); else return S + (s[2]); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...