Submission #998630

#TimeUsernameProblemLanguageResultExecution timeMemory
998630toast12Combo (IOI18_combo)C++14
97 / 100
22 ms1284 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int N) { string ans = ""; ans += 'A'; int x = press(ans); vector<char> poss; if (x) poss = {'B', 'X', 'Y'}; else { ans[0] = 'B'; x = press(ans); if (x) poss = {'A', 'X', 'Y'}; else { ans[0] = 'X'; x = press(ans); if (x) poss = {'A', 'B', 'Y'}; else { poss = {'A', 'B', 'X'}; ans[0] = 'Y'; } } } for (int i = 1; i < N-1; i++) { string s = ans+poss[0]; s += ans+poss[1]+poss[0]; s += ans+poss[1]+poss[1]; s += ans+poss[1]+poss[2]; x = press(s); if (x == (int)ans.size()+1) ans += poss[0]; else if (x == (int)ans.size()+2) ans += poss[1]; else ans += poss[2]; } if (N >= 2) { string s = ans+poss[0]; x = press(s); if (x == N) ans = s; else { s = ans+poss[1]; x = press(s); if (x == N) ans = s; else ans += poss[2]; } } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...