제출 #644843

#제출 시각아이디문제언어결과실행 시간메모리
644843tigar콤보 (IOI18_combo)C++14
100 / 100
32 ms616 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int N) { string rezz=""; char slova[]={'A', 'B', 'X', 'Y'}; int begg=0; if(press("AB")>=1) { if(press("A")==1){rezz+="A"; begg=0;} else {rezz+="B"; begg=1;} } else { if(press("X")==1){rezz+="X"; begg=2;} else {rezz+="Y"; begg=3;} } if(N==1)return rezz; for(int i=1; i<N-1; i++) { string prs=rezz+slova[(begg+1)%4]+slova[(begg+1)%4]; prs+=rezz+slova[(begg+1)%4]+slova[(begg+2)%4]; prs+=rezz+slova[(begg+1)%4]+slova[(begg+3)%4]; prs+=rezz+slova[(begg+2)%4]; int lnght=press(prs); if(lnght==i+2)rezz+=slova[(begg+1)%4]; else if(lnght==i+1)rezz+=slova[(begg+2)%4]; else rezz+=slova[(begg+3)%4]; } if(press(rezz+slova[(begg+1)%4])==N)return rezz+slova[(begg+1)%4]; else if(press(rezz+slova[(begg+2)%4])==N)return rezz+slova[(begg+2)%4]; else return rezz+slova[(begg+3)%4]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...