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 = "";
int ans = 0;
for(int i = 0; i < 3; i++){
ans = press(c[i]);
if(ans == 1){
s = c[i];
swap(c[i], c[3]);
break;
}
}
if(ans == 0){
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... |