제출 #687317

#제출 시각아이디문제언어결과실행 시간메모리
687317yellowtoad콤보 (IOI18_combo)C++17
100 / 100
47 ms556 KiB
#include <iostream> using namespace std; int press(string p); /*{ int x; cout << p << endl; cin >> x; return x; }*/ string guess_sequence(int n) { string s; int tmp; if (press("AB")) { if (press("A") == 1) s = "A"; else s = "B"; } else { if (press("X") == 1) s = "X"; else s = "Y"; } if (n > 1) { for (int i = 2; i < n; i++) { if (s[0] == 'A') { tmp = press(s+"B"+s+"XB"+s+"XX"+s+"XY"); if (tmp == i-1) s += "Y"; else if (tmp == i) s += "B"; else s += "X"; } else if (s[0] == 'B') { tmp = press(s+"A"+s+"XA"+s+"XX"+s+"XY"); if (tmp == i-1) s += "Y"; else if (tmp == i) s += "A"; else s += "X"; } else if (s[0] == 'X') { tmp = press(s+"A"+s+"BA"+s+"BB"+s+"BY"); if (tmp == i-1) s += "Y"; else if (tmp == i) s += "A"; else s += "B"; } else { tmp = press(s+"A"+s+"BA"+s+"BB"+s+"BX"); if (tmp == i-1) s += "X"; else if (tmp == i) s += "A"; else s += "B"; } } if (s[0] == 'A') { if (press(s+"B") == n) s += "B"; else if (press(s+"X") == n) s += "X"; else s += "Y"; } else if (s[0] == 'B') { if (press(s+"A") == n) s += "A"; else if (press(s+"X") == n) s += "X"; else s += "Y"; } else if (s[0] == 'X') { if (press(s+"A") == n) s += "A"; else if (press(s+"B") == n) s += "B"; else s += "Y"; } else { if (press(s+"A") == n) s += "A"; else if (press(s+"B") == n) s += "B"; else s += "X"; } } return s; } /*int main() { int n; cin >> n; cout << guess_sequence(n) << endl; }*/
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...