# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
282012 | 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
int x;
string tmp;
string guess_sequence(int N){
string cur="";
if(press("AB")>0){
if(press("A")==1)cur="A";
else cur="B";
}
else{
if(press("X")==1)cur="X";
else cur="Y";
}
vector<char> vec{'A','B','X','Y'};
for(int i=0;i<4;i++){
if(vec[i]==cur[0]){
vec.erase(vec.begin()+i);
break;
}
}
while(cur.size()<N){
if(cur.size()==N-1){
if(press(cur+vec[0])==N){
return cur+vec[0];
}
else if(press(cur+vec[1])==N){
return cur+vec[1];
}
else{
return cur+vec[2];
}
}
else{
tmp=cur+vec[0]+vec[0]+cur+vec[0]+vec[1]+cur+vec[0]+vec[2]+cur+vec[1];
x=press(tmp);
if(x==cur.size()+2){
cur+=vec[0];
}
else if(x==cur.size()+1){
cur+=vec[1];
}
else{
cur+=vec[2];
}
}
}
}