제출 #1007247

#제출 시각아이디문제언어결과실행 시간메모리
1007247makanhulia콤보 (IOI18_combo)C++17
100 / 100
22 ms2140 KiB
#include<bits/stdc++.h> #include"combo.h" using namespace std; string ans,coba; int n; string guess_sequence(int N) { n = N; for (int i=1; i<=n; i++) { if (i == 1) { coba = "AB"; int x = press(coba); if (x == 0) { coba = "X"; int y = press(coba); if (y == 1) { ans+="X"; } else { ans+="Y"; } } else { coba = "A"; int y = press(coba); if (y == 1) { ans+="A"; } else { ans+="B"; } } } else if (i < n) { if (ans[0] == 'A') { coba = ans + "B" + ans + "XB" + ans + "XX" + ans + "XY"; int x = press(coba); if (x == i) { ans += "B"; } else if (x == i + 1) { ans += "X"; } else { ans += "Y"; } } if (ans[0] == 'B') { coba = ans + "A" + ans + "XA" + ans + "XX" + ans + "XY"; int x = press(coba); if (x == i) { ans += "A"; } else if (x == i + 1) { ans += "X"; } else { ans += "Y"; } } if (ans[0] == 'X') { coba = ans + "B" + ans + "AB" + ans + "AA" + ans + "AY"; int x = press(coba); if (x == i) { ans += "B"; } else if (x == i + 1) { ans += "A"; } else { ans += "Y"; } } if (ans[0] == 'Y') { coba = ans + "B" + ans + "XB" + ans + "XX" + ans + "XA"; int x = press(coba); if (x == i) { ans += "B"; } else if (x == i + 1) { ans += "X"; } else { ans += "A"; } } } else { if (ans[0] == 'A') { coba = ans + "B"; int x = press(coba); if (x == n) { ans += "B"; } else { coba = ans + "X"; int y = press(coba); if (y == n) { ans += "X"; } else { ans += "Y"; } } } if (ans[0] == 'B') { coba = ans + "A"; int x = press(coba); if (x == n) { ans += "A"; } else { coba = ans + "X"; int y = press(coba); if (y == n) { ans += "X"; } else { ans += "Y"; } } } if (ans[0] == 'X') { coba = ans + "B"; int x = press(coba); if (x == n) { ans += "B"; } else { coba = ans + "A"; int y = press(coba); if (y == n) { ans += "A"; } else { ans += "Y"; } } } if (ans[0] == 'Y') { coba = ans + "B"; int x = press(coba); if (x == n) { ans += "B"; } else { coba = ans + "X"; int y = press(coba); if (y == n) { ans += "X"; } else { ans += "A"; } } } } } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...