# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
281996 | ec1117 | Combo (IOI18_combo) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "bits/stdc++.h";
using namespace std;
#define pb push_back
#define mp make_pair
string guess_sequence(int N){
string cur="";//default?
int x=press("AB");
if(x==1 || 2){
if(press("A")==1) cur="A";
else cur="B";
}
else{
if(press("X")==1)cur="X";
else cur="Y";
}
set<string> set={"A","B","X","Y"};
set.erase(cur);
while(cur.length()<N){
if(cur.length()==N-1){
if(press(cur+*next(set.begin(),1))==N){
return cur+*next(set.begin(),1);
}
else if(press(cur+*next(set.begin(),2))==N){
return cur+*next(set.begin(),2);
}
else{
return cur+*next(set.begin(),3);
}
}
else{
string tmp=cur+*next(set.begin(),1)+*next(set.begin(),1)+cur+*next(set.begin(),1)+*next(set.begin(),2)+cur+*next(set.begin(),1)+*next(set.begin(),3)+cur+*next(set.begin(),2);
int x=press(tmp);
if(x==cur.length()+2){
cur+=*next(set.begin(),1);
}
else if(x==cur.length()+1){
cur+=*next(set.begin(),2);
}
else{
cur+=*next(set.begin(),3);
}
}
}
}