# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
553652 | MadokaMagicaFan | 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>
int fc;
char ps[4] = {'A','B','X','Y'};
char getc(int x){
if (x >= fc)
++x;
return ps[x];
}
string guess_sequence(int N){
string s = "";
// char 1
if (press("AB")){
if (press("A"))
fc = 0;
else
fc = 1;
} else {
if (press("X"))
fc = 2;
else
fc = 3;
}
s += ps[fc];
if (N==1)
return s;
--N;
while(--N){
string q = s + getc(0) +
s + getc(1) + getc(0) +
s + getc(1) + getc(1) +
s + getc(1) + getc(2);
int ans = press(q);
if(ans == s.size())
s += getc(2);
else if(ans == s.size() + 1)
s += getc(0);
else
s += getc(1);
}
if (press(s+getc(0)) == s.size() + 1)
s += getc(0);
else if (press(s+getc(1)) == s.size() + 1)
s += getc(1);
else
s += getc(2);
return s;
}