# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
501316 | shantol | 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>
using namespace std;
string guess_sequence(int N){
string a;
string ex;
for(int i=0;i<N;i++){
if(!i){
if(press("AB")){
if(press("A"))a+="A";ex="BXY";
else a+="B";ex="AXY";
}
else if(press("X"))a+="X";ex="ABY";
else a+="Y";ex+="ABX";
}
else if(i==N-1){
if(press(a+ex[0]))a+=ex[0];
else if(press(ex[1]))a+=ex[1];
else a+=ex[2];
}
else{
int p=press(a+ex[0]+ex[0]+a+ex[0]+ex[1]+a+ex[0]+ex[2]+a+ex[1]);
if(p==2)a+=ex[0];
else if(p==1)a+=ex[1];
else a+=ex[2];
}
}
return a;
}
int main(){
int n;
cin>>n;
cout<<guess_sequence(n);
}