Submission #1082060

#TimeUsernameProblemLanguageResultExecution timeMemory
1082060idasCombo (IOI18_combo)C++17
100 / 100
24 ms1872 KiB
#include "bits/stdc++.h" #include "combo.h" #define FOR(i, begin, end) for(int i=(begin); i<(end); i++) #define sz(x) ((int)(x).size()) using namespace std; int n; std::string guess_sequence(int N) { n=N; string p=""; if(press("AB")>0) { if(press("A")>0) p+='A'; else p+='B'; } else { if(press("X")>0) p+='X'; else p+='Y'; } if(n==1) return p; vector<char> c; if(p=="A") c={'B','X','Y'}; if(p=="B") c={'A','X','Y'}; if(p=="X") c={'A','B','Y'}; if(p=="Y") c={'A','B','X'}; FOR(i, 0, n-2) { // string send=p+c[0]+c[0]+p+c[0]+c[1]+p+c[0]+c[2]+p+c[1]; string send=p; send+=c[0]; send+=c[0]; send+=p; send+=c[0]; send+=c[1]; send+=p; send+=c[0]; send+=c[2]; send+=p; send+=c[1]; int k=press(send); if(k==sz(p)) p+=c[2]; else if(k==sz(p)+1) p+=c[1]; else{ // cout << send << " " << p << " " << k << endl; assert(k==sz(p)+2); p+=c[0]; } } if(press(p+c[0]+p+c[1])==sz(p)+1) { if(press(p+c[0])==sz(p)+1) p+=c[0]; else p+=c[1]; } else { p+=c[2]; } return p; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...