# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
83536 | laptop_recai | Combo (IOI18_combo) | C++11 | 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.
string guess_sequence(int N) {
int k;
char first;
string S,button,p;
k = press("AB");
if(k == 2)
first = 'A';
else if(k == 1) {
if(press("A") == 1)
first = 'A', button = "BXY";
else
first = 'B', button = "AXY";
}
else {
if(press("X") == 1)
first = 'X', button = "ABY";
else
first = 'Y', button = "ABX";
}
S = first;
fori(i,1,N-1) {
p = (S + button[0]) + (S + button[1] + button[0]) + (S + button[1] + button[1]) + (S + button[1] + button[2]);
k = press(p);
if(k == i)
S += button[2];
else if(k == i+1)
S += button[0];
else
S += button[1];
}
k = press(S + button[0] + S + button[1]);
if(press(S + button[0]) == N)
S += button[0];
else if (press(S + button[1]) == N)
S += button[1];
else
S += button[2];
return S;
}