제출 #728448

#제출 시각아이디문제언어결과실행 시간메모리
728448MBI콤보 (IOI18_combo)C++17
0 / 100
48 ms208 KiB
#include "combo.h" // #include <iostream> using namespace std; string guess_sequence(int N) { int l=1,k; string s; if (press("A")){ s="A"; while (l<N){ if (l==N-1){ k=press(s+"B"); if (k>l) s+="B"; else if ((k=press(s+"X"))>l) 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 (press("B")){ s="B"; while (l<N){ if (l==N-1){ k=press(s+"A"); if (k>l) s+="A"; else if ((k=press(s+"X"))>l) s+="X"; else s+="Y"; break; } k=press(s+"A"+s+"XA"+s+"XX"+"XY"); if (k==l) { s+="Y"; l++; } if (k==l+1){ s+="A"; l++; } if (k==l+2){ s+="X"; l++; } } } else if (press("X")){ s="X"; while (l<N){ if (l==N-1){ k=press(s+"B"); if (k>l) s+="B"; else if ((k=press(s+"A"))>l) s+="A"; else s+="Y"; break; } k=press(s+"B"+s+"AB"+s+"AA"+"AY"); if (k==l) { s+="Y"; l++; } if (k==l+1){ s+="B"; l++; } if (k==l+2){ s+="A"; l++; } } } else { s="Y"; while (l<N){ if (l==N-1){ k=press(s+"B"); if (k>l) s+="B"; else if ((k=press(s+"X"))>l) s+="X"; else s+="A"; break; } k=press(s+"B"+s+"XB"+s+"XX"+"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...