제출 #1085078

#제출 시각아이디문제언어결과실행 시간메모리
1085078Staheos콤보 (IOI18_combo)C++14
100 / 100
25 ms1992 KiB
#include <string> #include "combo.h" #include <iostream> using namespace std; string guess_sequence(int N) { int ab = press("AB"); char first; string l[3]; if (ab > 0) { if (press("A") > 0) { first = 'A'; l[0] = "B"; l[1] = "X"; l[2] = "Y"; } else { first = 'B'; l[0] = "A"; l[1] = "X"; l[2] = "Y"; } } else { if (press("X") > 0) { first = 'X'; l[0] = "A"; l[1] = "B"; l[2] = "Y"; } else { first = 'Y'; l[0] = "A"; l[1] = "B"; l[2] = "X"; } } string p = ""; p += first; int m = 1; for (int i = 1; i < N - 1; i++) { string tmp = (p + l[0] + l[0]) + (p + l[0] + l[1]) + (p + l[0] + l[2]) + (p + l[1]); int x = press(tmp); if (x - m == 2) { p = p + l[0]; } else if (x - m == 1) { p = p + l[1]; } else { p = p + l[2]; } m++; } if (N != 1) { if (press(p + l[0]) > m) { p = p + l[0]; } else if (press(p + l[1]) > m) { p = p + l[1]; } else { p = p + l[2]; } } return p; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...