# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
696451 | Elvin_Fritl | 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"
using namespace std;
string guess_sequence(int n) {
string p = "";
string s="ABXY";
for(int i=0;i<3;i++){
string p1+=s[i];
if(press(p1)==1){
p=p1;
break;
}
}
if(p.size()==0){
p+=s[3];
}
string s2="";
for(int i=0;i<3;i++){
if(p[0]!=s[i]){
s2+=s[i];
}
}
s=s2;
for(int i=1;i<n;i++){
for(int j=0;j<2;j++){
string p1=p+s[j];
if(press(p1)==p1.size()){
p=p1;
break;
}
}
int kk=i;
if(p.size()==kk){
p+=s[2];
}
}
return p;
}