Submission #314522

#TimeUsernameProblemLanguageResultExecution timeMemory
314522jaaguptammeCombo (IOI18_combo)C++14
97 / 100
48 ms680 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; /*int press(string s){ cout<<s<<endl; int vl;cin>>vl; return vl; }*/ std::string guess_sequence(int N) { string t="ABXY",S=""; for(int i=0;i<3;i++){ string cur; cur+=t[i]; if(press(cur)==1){ S+=cur; break; } } if(!S.size())S+=t.back(); string nw; for(auto el:t){ if(el!=S[0])nw+=el; } t=nw; for(int i=1;i<N-1;i++){ string cur; cur+=S+t[0]; cur+=S+t[1]+t[0]; cur+=S+t[1]+t[1]; cur+=S+t[1]+t[2]; int vl=press(cur); if(vl==i+2){ S+=t[1]; }else if(vl==i+1){ S+=t[0]; }else{ S+=t[2]; } } if(N!=1){ for(int i=0;i<2;i++){ string cur; cur+=S+t[i]; if(press(cur)==N)return cur; } string cur; cur=S+t[2]; return cur; } return S; } /*int main(){ cout<<guess_sequence(3)<<endl; }*/
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...