Submission #82756

#TimeUsernameProblemLanguageResultExecution timeMemory
82756hugo_pmCombo (IOI18_combo)C++14
100 / 100
65 ms552 KiB
#include "combo.h" using namespace std; string S; int N; char ff; string cc = "ABXY"; string test = ""; string guess_sequence(int locN) { N = locN; int a1 = press("AB"); if (a1 == 0) { int a2 = press("X"); if (a2 == 0) S.push_back('Y'); else S.push_back('X'); } else { int a2 = press("A"); if (a2 == 0) S.push_back('B'); else S.push_back('A'); } if (N == 1) return S; for (char c : cc) if (c != S[0]) test.push_back(c); for (int i = 1; i < N-1; ++i) { string p; p.append(S); p.push_back(test[0]); for (char c : test) { p.append(S); p.push_back(test[1]); p.push_back(c); } int cc = press(p); if (cc == i) { S.push_back(test[2]); } else if (cc == i+1) { S.push_back(test[0]); } else { S.push_back(test[1]); } } for (int i = 0; i < 2; ++i) { if (press(S+test[i]) == N) return S+test[i]; } return S+test[2]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...