제출 #254925

#제출 시각아이디문제언어결과실행 시간메모리
254925niyu콤보 (IOI18_combo)C++14
100 / 100
40 ms664 KiB
using namespace std; #include "combo.h" char c[] = {'A', 'B', 'X', 'Y'}; char f; char s[3]; string guess_sequence(int N) { string ret = ""; int t = press("AB"); if (t > 0) { int tmp = press("A"); if (tmp > 0) f = 'A'; else f = 'B'; } else { int tmp = press("X"); if (tmp > 0) f = 'X'; else f = 'Y'; } ret += f; if (N == 1) return ret; int j = 0; for (int i = 0; i < 4; i++) { if (c[i] == f) continue; s[j] = c[i]; j++; } for (int i = 0; i < N - 2; i++) { t = press(ret + s[2] + s[0] + ret + s[2] + s[1] + ret + s[2] + s[2] + ret + s[1]); ret += s[t - ret.size()]; } t = press(ret + s[0]); if (t == N) return (ret + s[0]); t = press(ret + s[1]); if (t == N) return (ret + s[1]); return (ret + s[2]); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...