제출 #239406

#제출 시각아이디문제언어결과실행 시간메모리
239406ctziapo콤보 (IOI18_combo)C++14
5 / 100
1 ms200 KiB
#include "combo.h" using namespace std; std::string guess_sequence(int N) { std::string p = ""; string s; string s1; string s2; string s3; int t=press("AB"); if(t!=0){ int t2=press("A"); if(t2==1){ s="A"; s1="B"; s2="X"; s3="Y"; } else{ s="B"; s1="A"; s2="X"; s3="Y"; } } else { int t2=press("X"); if(t2==1){ s="X"; s1="B"; s2="Y"; s3="A"; } else{ s="Y"; s1="B"; s2="X"; s3="A"; } } // cout<<"first letter is "<<s<<endl; int cou=1; string ans; ans=s; for(int i=1;i<N-1;i++){ // cout<<ans<<" "<<ans.size()<<endl; string f; f=ans + s1 + ans + s2 + s1 + ans + s2 + s2 + ans + s2 + s3; int t=press(f); // cout<<f<<" "<<t<<" "<<f.size()<<"/"<<N<<endl; // cout<<endl; if(t==cou+1){ cou++; ans=ans+s1; continue; } else if(t==cou+2){ cou++; ans=ans + s2; continue; } else { cou++; ans=ans + s3; continue; } } // cout<<"answeeer "<<ans<<endl; if(press(ans + s1)==N){ ans = ans + s1; } else if(press(ans + s2)==N){ ans = ans + s2; } else ans = ans + s3; return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...