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 "combo.h"
#include <bits/stdc++.h>
using namespace std;
string ans, s[3];
char c[3];
string guess_sequence(int n)
{
if (press("AB"))
{
if (press("A"))
{
ans.push_back('A');
c[0]='B';
c[1]='X';
c[2]='Y';
s[0]="B";
s[1]="X";
s[2]="Y";
}
else
{
ans.push_back('B');
c[0]='A';
c[1]='X';
c[2]='Y';
s[0]="A";
s[1]="X";
s[2]="Y";
}
}
else
{
if (press("X"))
{
ans.push_back('X');
c[0]='A';
c[1]='B';
c[2]='Y';
s[0]="A";
s[1]="B";
s[2]="Y";
}
else
{
ans.push_back('Y');
c[0]='A';
c[1]='B';
c[2]='X';
s[0]="A";
s[1]="B";
s[2]="X";
}
}
for (int i=1; i<=n-2; i++)
{
int res=press(ans+s[0]+s[0]+ans+s[0]+s[1]+ans+s[0]+s[2]+ans+s[1]);
if (res==i)
ans.push_back(c[2]);
else if (res==i+1)
ans.push_back(c[1]);
else
ans.push_back(c[0]);
}
if (n>=2)
{
if (press(ans+s[0])==n)
ans.push_back(c[0]);
else if (press(ans+s[1])==n)
ans.push_back(c[1]);
else
ans.push_back(c[2]);
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |