이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |