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"
// #include "grader.cpp"
using namespace std;
char c[4] = {'A', 'B', 'X', 'Y'};
string guess_sequence(int n)
{
string s = "";
int ret = press("AB");
if(ret == 0)
{
if(press("X"))
{
s += "X";
swap(c[0], c[2]);
}
else{
s += "Y";
swap(c[0], c[3]);
}
}
else{
if(press("A"))
{
s += "A";
}
else{
s += "B";
swap(c[0], c[1]);
}
}
if(n == 1) return s;
for(int i=1 ; i<n-1 ; i++)
{
string temp = "";
temp += s;
temp += c[1];
temp += c[1];
temp += s;
temp += c[1];
temp += c[2];
temp += s;
temp += c[1];
temp += c[3];
temp += s;
temp += c[2];
int ret = press(temp);
if(ret == i) s += c[3];
else if(ret == i + 1) s += c[2];
else s += c[1];
}
// cout << n << ' ' << s.size() << endl;
if(press(s + c[1]) == n) s += c[1];
else if(press(s + c[2]) == n) s += c[2];
else s += c[3];
return s;
}
//ABBXXYYXYYXBBXY
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |