Submission #153475

#TimeUsernameProblemLanguageResultExecution timeMemory
153475nandonathanielCombo (IOI18_combo)C++14
100 / 100
45 ms784 KiB
#include "combo.h" #include<bits/stdc++.h> using namespace std; string guess_sequence(int N) { string p = ""; int ask=press("AB"); if(ask>0){ ask=press("A"); if(ask==1)p="A"; else p="B"; } else{ ask=press("X"); if(ask==1)p="X"; else p="Y"; } if(N==1)return p; vector<string> bukan; if("A"!=p)bukan.push_back("A"); if("B"!=p)bukan.push_back("B"); if("X"!=p)bukan.push_back("X"); if("Y"!=p)bukan.push_back("Y"); for(int i=2;i<=N-1;i++){ string tebak=p+bukan[1]; for(int j=0;j<3;j++)tebak=tebak+p+bukan[2]+bukan[j]; ask=press(tebak); if(ask==i-1)p=p+bukan[0]; else if(ask==i)p=p+bukan[1]; else p=p+bukan[2]; } bool ada=false; for(int i=0;i<2;i++){ ask=press(p+bukan[i]); if(ask==N){ p=p+bukan[i]; ada=true; break; } } if(!ada)p=p+bukan[2]; return p; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...