Submission #788825

#TimeUsernameProblemLanguageResultExecution timeMemory
788825ThylOneCombo (IOI18_combo)C++14
100 / 100
27 ms664 KiB
#include "combo.h" #include<bits/stdc++.h> using namespace std; vector<string> LETTERS = {"A","B","X","Y"}; std::string guess_sequence(int N) { string D=""; string guess = "AB"; int P=press(guess); if(P==1){ guess="A"; P=press(guess); if(P==1){ D="A"; }else{ D="B"; } }else if(P==2){ D="A"; }else{ guess="X"; P=press(guess); if(P==1){ D="X"; }else{ D="Y"; } } if(D=="")D=LETTERS[3]; vector<string> letters; for(string&L:LETTERS){ if(L==D)continue; letters.push_back(L); } string S=D; for(int i=1;i<N-1;i++){ string guess = S+letters[0]+S+letters[1]+letters[0]+S+letters[1]+letters[1]+S+letters[1]+letters[2]; int P=press(guess); if(P==(i+1)){ S+=letters[0]; }else if(P==(i+2)){ S+=letters[1]; }else{ S+=letters[2]; } } if(N!=1){ if(press(S+letters[0])==N){ S+=letters[0]; }else if(press(S+letters[1])==N){ S+=letters[1]; }else{ S+=letters[2]; }} cerr<<S<<'\n'; return S; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...