제출 #923274

#제출 시각아이디문제언어결과실행 시간메모리
923274Pacybwoah콤보 (IOI18_combo)C++17
100 / 100
15 ms1860 KiB
#include<string> #include<vector> #include "combo.h" using namespace std; std::string guess_sequence(int N) { string t=""; char st; if(press("AB")){ if(press("A")) t+="A"; else t+="B"; } else{ if(press("X")) t+="X"; else t+="Y"; } if(N==1) return t; st=t[0]; vector<string> base(4,""); string poss="ABXY",tmp=""; for(int i=0;i<4;i++){ if(poss[i]!=st) tmp+=poss[i]; } poss=tmp; base[0]+=poss[0]; for(int i=2;i>=0;i--){ base[i]=base[0]; base[i]+=poss[i]; } base[3]+=poss[1]; for(int i=1;i<N-1;i++){ string guess=""; for(int j=0;j<4;j++){ guess+=t+base[j]; } //cout<<guess<<"\n"; int res=press(guess); //cout<<res; if(res==i+2) t+=poss[0]; else if(res==i+1) t+=poss[1]; else t+=poss[2]; } if(press(t+poss[0])==N) t+=poss[0]; else if(press(t+poss[1])==N) t+=poss[1]; else t+=poss[2]; return t; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...