Submission #391772

#TimeUsernameProblemLanguageResultExecution timeMemory
391772REALITYNBCombo (IOI18_combo)C++14
5 / 100
1 ms276 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string guess_sequence(int n){ char sep ; if(press("AB")!=0){ if(press("A")) sep='A' ; else sep = 'B' ; } else{ if(press("X")) sep='X' ; else sep='Y' ; } string ans ; ans+=sep ; vector<char> B = {'A','B','X','Y'} ; for(int i=0;i<4;i++){ if(B[i]==sep){ B.erase(B.begin()+i) ; break ; } } for(int len=2;len<n;len++){ string ask = ans ; ask+=B[0] ; for(char x : B){ ask+=ans; ask+=B[1]; ask+=x; } int res = press(ask) ; if(res==len){ ans+=B[0] ; } else if(res!=len-1){ ans+=B[1] ; } else{ ans+=B[2] ; } } string ask = ans ; ask+=B[0] ; ask+=ans ; ask+=B[1] ; int res = press(ask) ; if(res==n){ ask=ans+B[0] ; res = press(ask); if(res==n) ans+=B[0]; else ans+=B[1]; } else ans+=B[2]; return ans ; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...