제출 #687278

#제출 시각아이디문제언어결과실행 시간메모리
687278yellowtoad콤보 (IOI18_combo)C++17
5 / 100
1 ms208 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"; } 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...