# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
738991 | raul2008487 | 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 "combo.h"
#include<bits/stdc++.h>
#define pb push_back
std::string guess_sequence(int N) {
string s="";
int cc=1,st;
ll cs1=press("AB"),cs2=press("AX");
vector<string> vec;
if(cs1==2){
s+="AB";
vec.pb('B');
vec.pb('X');
vec.pb('Y');
}
else if(cs2==2){
s+="AX";
vec.pb('B');
vec.pb('X');
vec.pb('Y');
}
else if(cs1==1 && cs2==1){
s+="AY";
vec.pb('B');
vec.pb('X');
vec.pb('Y');
}
else if(cs1==1){
s+='B';
vec.pb('A');
vec.pb('X');
vec.pb('Y');
}
else if(cs2==1){
s+='X';
vec.pb('A');
vec.pb('B');
vec.pb('Y');
}
else{
s+='Y';
vec.pb('B');
vec.pb('X');
vec.pb('A');
}
st=s.size();
if(st==N){
return s;
}
for(int i=st;i<n-1;i++){
int query=press(s+v[0]+s+v[1]+v[1]+s+v[1]+v[2]);
if(query==(i+1)){
s+=v[0];
}
else if(query==(i+2)){
s+=v[1];
}
else{
s+=v[2];
}
}
if(press(s+v[0])==N){
return s+v[0];
}
else if(press(s+v[1])==N){
return s+v[1];
}
return s+v[2];
}