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<cstdio>
#include "combo.h"
#include<string>
#include<iostream>
using namespace std;
string x[4] = {"A", "B", "X", "Y"};
string guess_sequence(int n)
{
int f;
string ans;
if(press("AB"))
{
if(press("A")) f = 0;
else f = 1;
}
else
{
if(press("X")) f = 2;
else f = 3;
}
ans += x[f];
for(int i = 2;i <= n;i++)
{
string a, b, c, d;
a = b = c = d = x[f];
int cnt = 0;
for(int j = 0;j < 4;j++)
{
if(j == f) continue;
if(cnt == 0)
{
a += x[j]; a += x[j];
b += x[j]; c += x[j];
}
else if(cnt == 1)
{
b += x[j]; d += x[j];
}
else c += x[j];
cnt++;
}
string s = a + b + c + d;
int p = 3 - press(s);
for(int j = 0;j < 4;j++)
{
if(j == f) continue;
if(cnt == p) {f = j;break;}
}
ans += x[f];
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |