Submission #1185628

#TimeUsernameProblemLanguageResultExecution timeMemory
1185628hamzabcCombo (IOI18_combo)C++20
0 / 100
0 ms408 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; char lst[4] = {'A', 'B', 'X', 'Y'}; char stopper = 0; std::string guess_sequence(int N) { string S; int a = press("AB"); if (a){ a = press("B"); if (a){ stopper = 1; S = "B"; }else{ stopper = 0; S = "A"; } }else{ a = press("X"); if (a){ stopper = 2; S = "X"; }else{ stopper = 3; S = "Y"; } } for (int i = S.size(); i < N; i++){ if (i < N - 1){ int c = press(S + lst[stopper + 1] + S + lst[stopper + 2] + lst[stopper + 1] + S + lst[stopper + 2] + lst[stopper + 2] + S + lst[stopper + 2] + lst[stopper + 3]); if (c == S.size()){ S = S + lst[stopper + 3]; }else if (c == S.size() + 1){ S = S + lst[stopper + 1]; }else{ S = S + lst[stopper + 2]; } }else{ int a = press(S + lst[stopper + 1] + S + lst[stopper + 2]); if (a > S.size()){ a = press(S + lst[stopper + 1]); if (a > S.size()){ return S + lst[stopper + 1]; } return S + lst[stopper + 2]; } return S + lst[stopper + 3]; } } return S; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...