제출 #820286

#제출 시각아이디문제언어결과실행 시간메모리
820286Osplei콤보 (IOI18_combo)C++17
5 / 100
1 ms296 KiB
#include "combo.h" using namespace std; string guess_sequence(int N) { string p = ""; p="AB"; int coins = press(p); if (coins!=0) { p="A"; coins = press(p); if (coins==0) p="B"; } else { p="X"; coins = press(p); if (coins==0) p="Y"; } string S = p; if (p=="A"){ while ((int) S.size() != N-1){ p=S; p+='B'; p+=S; p+="XX"; p+=S; p+="XB"; p+=S; p+="XY"; coins = press(p); if (coins == (int) S.size()) S+='Y'; else if (coins == (int) S.size()+1) S+='B'; else S+='X'; } p=S; p+='B'; coins = press(p); if (coins == N) S+='B'; else { p=S; p+='X'; coins = press(p); if (coins == N) S+='X'; else S+='Y'; } } else if (p=="B"){ while ((int) S.size() != N-1){ p=S; p+='A'; p+=S; p+="XX"; p+=S; p+="XA"; p+=S; p+="XY"; coins = press(p); if (coins == (int) S.size()) S+='Y'; else if (coins == (int) S.size()+1) S+='A'; else S+='X'; } p=S; p+='A'; coins = press(p); if (coins == N) S+='A'; else { p=S; p+='X'; coins = press(p); if (coins == N) S+='X'; else S+='Y'; } } else if (p=="X"){ while ((int) S.size() != N-1){ p=S; p+='B'; p+=S; p+="AA"; p+=S; p+="AB"; p+=S; p+="AY"; coins = press(p); if (coins == (int) S.size()) S+='Y'; else if (coins == (int) S.size()+1) S+='B'; else S+='A'; } p=S; p+='B'; coins = press(p); if (coins == N) S+='B'; else { p=S; p+='A'; coins = press(p); if (coins == N) S+='A'; else S+='Y'; } } else { while ((int) S.size() != N-1){ p=S; p+='B'; p+=S; p+="XX"; p+=S; p+="XB"; p+=S; p+="XA"; coins = press(p); if (coins == (int) S.size()) S+='A'; else if (coins == (int) S.size()+1) S+='B'; else S+='X'; } p=S; p+='B'; coins = press(p); if (coins == N) S+='B'; else { p=S; p+='X'; coins = press(p); if (coins == N) S+='X'; else S+='A'; } } return S; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...