제출 #964318

#제출 시각아이디문제언어결과실행 시간메모리
964318BestCrazyNoob콤보 (IOI18_combo)C++17
5 / 100
1 ms504 KiB
#include "combo.h" using namespace std; string guess_sequence(int N) { char map[] = {'A', 'B', 'X', 'Y'}; string ans = ""; // Determine first letter int first_idx; if (press("AB")) { if (press("A")) first_idx = 0; else first_idx = 1; } else { if (press("X")) first_idx = 2; else first_idx = 3; } swap(map[0], map[first_idx]); ans += map[0]; // Add letters form 1 to n-2 for (int i = 1; i < N-1; i++) { int res = press(ans + map[2] + ans + map[3] + map[1] + ans + map[3] + map[2] + ans + map[3] + map[3]); if (res == i) ans += map[1]; else if (res == i+1) ans += map[2]; else if (res == i+2) ans += map[3]; else abort(); } // add last letter if (press(ans + map[1]) == N) ans += map[1]; else if (press(ans + map[2]) == N) ans += map[2]; else ans += map[3]; return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...