제출 #76099

#제출 시각아이디문제언어결과실행 시간메모리
76099gs18115콤보 (IOI18_combo)C++14
100 / 100
49 ms584 KiB
#include"combo.h" using namespace std; string guess_sequence(int N) { string ans=""; char first; char P[3]; if(press("AB")>0) { if(press("A")>0) first='A'; else first='B'; } else { if(press("X")>0) first='X'; else first='Y'; } ans=ans+first; if(first=='A') { P[0]='B'; P[1]='X'; P[2]='Y'; } else if(first=='B') { P[0]='A'; P[1]='X'; P[2]='Y'; } else if(first=='X') { P[0]='A'; P[1]='B'; P[2]='Y'; } else { P[0]='A'; P[1]='B'; P[2]='X'; } int i,X; for(i=2;i<N;i++) { X=press(ans+P[0]+P[0]+ans+P[0]+P[1]+ans+P[0]+P[2]+ans+P[1]); if(X>i) ans=ans+P[0]; else if(X==i) ans=ans+P[1]; else ans=ans+P[2]; } if(N>1) { if(press(ans+P[0])==N) ans=ans+P[0]; else if(press(ans+P[1])==N) ans=ans+P[1]; else ans=ans+P[2]; } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...