# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
130129 | HungAnhGoldIBO2020 | 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<iostream>
#include "combo.h"
using namespace std;
char ohyeah[]={'X','Y','A','B'};
char lis[5];
string guess_sequence(int N){
string cac="",cac1;
if(press("AB")){
if(press("A")){
cac+='A';
}
else{
cac+='B';
}
}
else{
if(press("X")){
cac+='X';
}
else{
cac+='Y';
}
}
if(N==1){
return cac;
}
int i,j=0;
for(i=0;i<4;i++){
if(s[i]!=cac[0]){
j++;
lis[j]=s[i];
}
}
for(i=1;i<N-1;i++){
cac1=cac+lis[1]+cac+lis[2]+lis[3]+cac+lis[2]+lis[1]+cac+lis[2]+lis[2];
j=press(cac1);
if(j==i+1){
cac+=lis[1];
}
else{
if(j==i){
cac+=lis[3];
}
else{
cac+=lis[2];
}
}
}
if(press(cac+lis[1])==N){
return cac+lis[1];
}
if(press(cac+lis[2])==N){
return cac+lis[2];
}
return cac+lis[3];
}