Submission #1239002

#TimeUsernameProblemLanguageResultExecution timeMemory
1239002TimoshCombo (IOI18_combo)C++20
100 / 100
7 ms600 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"; } if (N == 1) return S; 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]; } a = b = c = S; a += s[0]; b += s[1]; c += s[2]; if (press(a) == N) return a; else if (press(b) == N) return b; else return c; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...