# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
236990 | kai824 | 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"
using namespace std;
string guess_sequence(int n){
string cur,choices="",abxy="ABXY",t;
if(press("AB")>0){
if(press("A")>0)cur="A";
else cur="B";
}else{
if(press("X")>0)cur="X";
else cur="Y";
}
if(n==1)return cur;
for(int i=0;i<4;i++){
if(cur[0]==abxy[i])continue;
choices+=abxy[i];
}
int k;
for(int i=1;i<n-1;i++){
t="";
for(int j=0;j<3;j++)t+=cur+choices[0]+choices[j];
k=press(t+cur+choices[1]);
if(k==i)cur+=choices[2];
else if(k==i+1)cur+=choices[1];
else{
cur+=choices[0];
}
}
if(press(cur+choices[0])==n){
return cur+choices[0]
}else{
if(press(cur+choices[1])==n)return cur+choices[1];
else return cur+choices[2];
}
}