제출 #728466

#제출 시각아이디문제언어결과실행 시간메모리
728466MBI콤보 (IOI18_combo)C++17
100 / 100
28 ms580 KiB
#include "combo.h" // #include <iostream> using namespace std; string guess_sequence(int N) { int l=1,k; string s; if (press("AB")>=1){ if (press("A")) s="A"; else s="B"; } else { if (press("X")) s="X"; else s="Y"; } if (s=="A"){ while (l<N){ if (l==N-1){ k=press(s+"B"+s+"X"); if (k==N){ if (press(s+"B")==N) s+="B"; else s+="X"; } else s+="Y"; break; } k=press(s+"B"+s+"XB"+s+"XX"+s+"XY"); if (k==l) { s+="Y"; l++; } if (k==l+1){ s+="B"; l++; } if (k==l+2){ s+="X"; l++; } } } else if (s=="B"){ while (l<N){ if (l==N-1){ k=press(s+"A"+s+"X"); if (k==N){ if (press(s+"A")==N) s+="A"; else s+="X"; } else s+="Y"; break; } k=press(s+"A"+s+"XA"+s+"XX"+s+"XY"); if (k==l) { s+="Y"; l++; } if (k==l+1){ s+="A"; l++; } if (k==l+2){ s+="X"; l++; } } } else if (s=="X"){ while (l<N){ if (l==N-1){ k=press(s+"B"+s+"A"); if (k==N){ if (press(s+"B")==N) s+="B"; else s+="A"; } else s+="Y"; break; } k=press(s+"B"+s+"AB"+s+"AA"+s+"AY"); if (k==l) { s+="Y"; l++; } if (k==l+1){ s+="B"; l++; } if (k==l+2){ s+="A"; l++; } } } else { while (l<N){ if (l==N-1){ k=press(s+"B"+s+"X"); if (k==N){ if (press(s+"B")==N) s+="B"; else s+="X"; } else s+="A"; break; } k=press(s+"B"+s+"XB"+s+"XX"+s+"XA"); if (k==l) { s+="A"; l++; } if (k==l+1){ s+="B"; l++; } if (k==l+2){ s+="X"; l++; } } } // cerr << s << " \n"; return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...