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>
using namespace std;
string c[] = {"A", "B", "X", "Y"};
int press(string);
string guess_sequence(int N){
string s = "";
if(press(c[0] + c[1])){
if(press(c[0])){
s = c[0];
swap(c[0], c[3]);
}
else{
s = c[1];
swap(c[1], c[3]);
}
} else if(press(c[2])){
s = c[2];
swap(c[2], c[3]);
} else{
s = c[3];
}
for(int i = 1; i < N; i++){
if(i == N-1){
if(press(s + c[0]) == N){
s += c[0];
break;
}
if(press(s + c[1]) == N){
s += c[1];
break;
}
s += c[2];
break;
}
string toask = (s + c[0] + c[0]) + (s + c[0] + c[1]) + (s + c[0] + c[2]) + (s + c[1]);
int cur = press(toask);
if(cur == i + 2){
s += c[0];
} else if(cur == i + 1){
s += c[1];
} else if(cur == i){
s += c[2];
}
}
return s;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |