제출 #998636

#제출 시각아이디문제언어결과실행 시간메모리
998636toast12콤보 (IOI18_combo)C++14
100 / 100
24 ms1000 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int N) { string ans = ""; string s = "AB"; vector<char> poss; int x = press(s); if (x >= 1) { if (x == 2) { ans += 'A'; poss = {'B', 'X', 'Y'}; } else { s = "A"; x = press(s); if (x) { ans += 'A'; poss = {'B', 'X', 'Y'}; } else { ans += 'B'; poss = {'A', 'X', 'Y'}; } } } else { s = "X"; x = press(s); if (x) { ans += 'X'; poss = {'A', 'B', 'Y'}; } else { ans += 'Y'; poss = {'A', 'B', 'X'}; } } 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...