제출 #1206949

#제출 시각아이디문제언어결과실행 시간메모리
1206949a1m4n콤보 (IOI18_combo)C++20
100 / 100
6 ms484 KiB
#ifdef AIMAN #define _GLIBCXX_DEBUG #endif #include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int n) { string ans; int matched = 0; int x = press("AB"); if (x == 0) { x = press("X"); ans += (x == 1 ? 'X' : 'Y'); } else { x = press("A"); ans += (x == 1 ? 'A' : 'B'); } matched = 1; while (matched + 2 <= n) { char s0 = ans[0]; if (s0 == 'A') { x = press(ans + "BB" + ans + "BX" + ans + "BY" + ans + "X"); ans += (x == matched ? 'Y' : (x == matched+1 ? 'X' : 'B')); } else if (s0 == 'B') { x = press(ans + "AA" + ans + "AX" + ans + "AY" + ans + "X"); ans += (x == matched ? 'Y' : (x == matched+1 ? 'X' : 'A')); } else if (s0 == 'X') { x = press(ans + "AA" + ans + "AB" + ans + "AY" + ans + "B"); ans += (x == matched ? 'Y' : (x == matched+1 ? 'B' : 'A')); } else { x = press(ans + "BB" + ans + "BX" + ans + "BA" + ans + "X"); ans += (x == matched ? 'A' : (x == matched+1 ? 'X' : 'B')); } matched++; } if (matched == n-1) { char s0 = ans[0]; if (s0 == 'A') { x = press(ans + "B"); if (x == n) ans += 'B'; else { x = press(ans + "X"); ans += (x == n ? 'X' : 'Y'); } } else if (s0 == 'B') { x = press(ans + "A"); if (x == n) ans += 'A'; else { x = press(ans + "X"); ans += (x == n ? 'X' : 'Y'); } } else if (s0 == 'X') { x = press(ans + "A"); if (x == n) ans += 'A'; else { x = press(ans + "B"); ans += (x == n ? 'B' : 'Y'); } } else { x = press(ans + "B"); if (x == n) ans += 'B'; else { x = press(ans + "X"); ans += (x == n ? 'X' : 'A'); } } } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...