제출 #1008239

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