제출 #145355

#제출 시각아이디문제언어결과실행 시간메모리
145355dolphingarlic콤보 (IOI18_combo)C++14
100 / 100
46 ms560 KiB
#include "combo.h" #include <vector> using namespace std; string guess_sequence(int N) { string S; vector<char> possible; if (press("AB") != 0) { if (press("A") != 0) { S = "A"; possible = {'B', 'X', 'Y'}; } else { S = "B"; possible = {'A', 'X', 'Y'}; } } else { if (press("X") != 0) { S = "X"; possible = {'A', 'B', 'Y'}; } else { S = "Y"; possible = {'A', 'B', 'X'}; } } for (int i = 2; i < N; i++) { int k = press(S + possible[0] + S + possible[1] + possible[0] + S + possible[1] + possible[1] + S + possible[1] + possible[2]); if (k == i) { S += possible[0]; } else if (k == i + 1) { S += possible[1]; } else { S += possible[2]; } } if (N > 1) { if (press(S + possible[0]) == N) S += possible[0]; else if (press(S + possible[1]) == N) S += possible[1]; else S += possible[2]; } return S; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...