# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
550424 | don2001 | Combo (IOI18_combo) | C++14 | 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>
#define fast ios::sync_with_stdio(false); cin.tie(NULL);
using namespace std;
#include "combo.h"
string guess_sequence(int n) {
string ans; vector<char>v;
int a=press("AB");
int b=press("XY");
if(a>0){
int c=press("A");
if(c>0){
ans.push_back('A');
v.push_back('B');v.push_back('X');v.push_back('Y');
}
else{
ans.push_back('B');
v.push_back('A');v.push_back('X');v.push_back('Y');
}
}
else{
int c=press("X");
if(c>0){
ans.push_back('X');
}
else{
ans.push_back('Y');
}
}
for(int i=1;i<n-1;i++){
string ask;
ask+=ans;
ask+=v[0];
ask+=ans;
ask+=v[1];ask+=v[0];
ask+=ans;
ask+=v[1];ask+=v[1];
ask+=ans;
ask+=v[1];ask+=v[2];
if(press(ask)==i+2){
ans.push_back(v[1]);
}
else if(press(ask)==i+1){
ans.push_back(v[0]);
}
else{
ans.push_back(v[2]);
}
}
for(int i=0;i<=1;i++){
string s=ans+v[i];
if(press(s)==n){
f=0;
ans=s;
}
}
if(f){
ans=ans+v[2];
}
return ans;
}