제출 #1085049

#제출 시각아이디문제언어결과실행 시간메모리
1085049Staheos콤보 (IOI18_combo)C++14
5 / 100
1 ms344 KiB
#include <string> #include "combo.h" #include <iostream> using namespace std; string guess_sequence(int N) { int ab = press("AB"); char first; string* l = new string[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++) { int x = press((p + l[0] + l[0]) + (p + l[0] + l[1]) + (p + l[0] + l[2]) + (p + l[1])); if (x - m == 2) { p += l[0]; } else if (x - m == 1) { p += l[1]; } else { p += l[2]; } m++; } ab = press(p + l[0] + p + l[1]); if (ab > m) { if (press(p + l[0]) > m) { p += l[0]; } else { p += l[1]; } } else { p += l[2]; } return p; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...