제출 #173642

#제출 시각아이디문제언어결과실행 시간메모리
173642lckcode콤보 (IOI18_combo)C++14
100 / 100
51 ms560 KiB
#include "combo.h" #include<bits/stdc++.h> using namespace std; std::string guess_sequence(int N) { int n = N; string res = ""; if (press("AB") > 0) { if (press("A") > 0) res = "A"; else res = "B"; } else { if (press("X") > 0) res = "X"; else res = "Y"; } char st = res[0]; for (int i = 2; i <= n - 1; ++i) { if (st == 'A') { int x = press(res + "B" + res + "XY" + res +"XB" +res +"XX"); // cout << x << endl; if (x == i) res += "B"; else if(x == i+1) res += "X"; else res += "Y"; } else if (st == 'B') { int x = press(res + "A" + res + "XY" + res +"XA" +res +"XX"); if (x == i) res += "A"; else if(x == i+1) res += "X"; else res += "Y"; } else if (st == 'X') { int x = press(res + "B" + res + "AY" + res +"AA" +res +"AB"); if (x == i) res += "B"; else if(x == i+1) res += "A"; else res += "Y"; } else { int x = press(res + "B" + res + "AX" + res +"AA" +res +"AB"); if (x == i) res += "B"; else if(x == i+1) res += "A"; else res += "X"; } // cout << res << endl; } if (n > 1) { if (st == 'A') { if(press(res +"B") == n) res = res +"B"; else if (press(res + "X") == n) res = res +"X"; else res = res +"Y"; } else if (st == 'B') { if(press(res +"A") == n) res = res +"A"; else if (press(res + "X") == n) res = res +"X"; else res = res +"Y"; } else if (st == 'X') { if(press(res +"A") == n) res = res +"A"; else if (press(res + "B") == n) res = res +"B"; else res = res +"Y"; } else { if(press(res +"A") == n) res = res +"A"; else if (press(res + "B") == n) res = res +"B"; else res = res +"X"; } } return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...