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>
#include <combo.h>
using namespace std;
string guess_sequence(int N){
string result;
int guessresult;
guessresult = press("AB");
if(guessresult){
guessresult = press("A");
if(guessresult)
result = "A";
else
result = "B";
}
else{
guessresult = press("X");
if(guessresult)
result = "X";
else
result = "Y";
}
if(N==1)
return result;
if(result[0]=='A')
for(int i=0;i<N-2;i++){
guessresult = press(result + "B" + result + "XB" + result + "XX" + result + "XY");
if(guessresult == (int)result.size()-1){
result.push_back('B');
}
else if(guessresult == (int)result.size()){
result.push_back('Y');
}
else{
result.push_back('X');
}
}
if(result[0]=='B')
for(int i=0;i<N-2;i++){
guessresult = press(result + "A" + result + "XA" + result + "XX" + result + "XY");
if(guessresult == (int)result.size()-1){
result.push_back('A');
}
else if(guessresult == (int)result.size()){
result.push_back('Y');
}
else{
result.push_back('X');
}
}
else if(result[0]=='X')
for(int i=0;i<N-2;i++){
guessresult = press(result + "B" + result + "AB" + result + "AA" + result + "AY");
if(guessresult == (int)result.size()-1){
result.push_back('B');
}
else if(guessresult == (int)result.size()){
result.push_back('Y');
}
else{
result.push_back('A');
}
}
else if(result[0]=='Y')
for(int i=0;i<N-2;i++){
guessresult = press(result + "B" + result + "XB" + result + "XX" + result + "XA");
if(guessresult == (int)result.size()-1){
result.push_back('B');
}
else if(guessresult == (int)result.size()){
result.push_back('A');
}
else{
result.push_back('X');
}
}
guessresult = press(result+"A"+result+"B");
if(guessresult == N){
guessresult = press(result+"A");
if(guessresult == N)
result.push_back('A');
else
result.push_back('B');
}
else{
guessresult = press(result+"X");
if(guessresult == N)
result.push_back('X');
else
result.push_back('Y');
}
return result;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |