# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
110012 | mefbayar | 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 s;
char c[4];
string guess_sequence(int N){
int k;
if(press("AB")){
if(press("A")){
c[0]="B";
c[1]="X";
c[2]="Y";
s="A";
}else{
c[0]="A";
c[1]="X";
c[2]="Y";
s="B";
}
}else{
if(press("X")){
c[0]="B";
c[1]="A";
c[2]="Y";
s="X";
}else{
c[0]="A";
c[1]="X";
c[2]="B";
s="Y";
}
}
if(N==1) return s;
for(int i = 2; i < N; i++){
k = press(s + c[0] + c[1] + s + c[0] + c[0] + s + c[0] + c[2] + s + c[1]);
if(k == i + 1){
s += c[0];
} else if(k == i){
s += c[1];
} else {
s += c[2];
}
}
if(press(s + c[0]) == N){
s += c[0];
} else {
if(press(s + c[1]) == N){
s += c[1];
} else {
s += c[2];
}
}
return s;
}