제출 #1008260

#제출 시각아이디문제언어결과실행 시간메모리
1008260Unlucky콤보 (IOI18_combo)C++17
100 / 100
21 ms1892 KiB
#include <bits/stdc++.h> using namespace std; #include "combo.h" string guess_sequence(int n){ string ans; string guess[5]; if (press("AB")){ if (press("A")){ ans = "A"; guess[0] = "BB"; guess[1] = "BX"; guess[2] = "BY"; guess[3] = "X"; guess[4] = "Y"; } else { ans = "B"; guess[0] = "AA"; guess[1] = "AX"; guess[2] = "AY"; guess[3] = "X"; guess[4] = "Y"; } } else { if (press("X")){ ans = "X"; guess[0] = "AA"; guess[1] = "AB"; guess[2] = "AY"; guess[3] = "B"; guess[4] = "Y"; } else { ans = "Y"; guess[0] = "AA"; guess[1] = "AB"; guess[2] = "AX"; guess[3] = "B"; guess[4] = "X"; } } for (int i = 1; i < n-1; i++){ int res = press(ans+guess[0] + ans+guess[1] + ans+guess[2] + ans+guess[3]); if (res == i+2){ ans += guess[0][0]; } else if (res == i+1){ ans += guess[3]; } else { ans += guess[4]; } } if (n == 1) { return ans; } if (press(ans+guess[3] + ans+guess[4]) == n){ if (press(ans+guess[3]) == n){ return ans+guess[3]; } else { return ans+guess[4]; } } else { return ans+guess[0][0]; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...