이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include<combo.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define sc second
#define th third
#define fo fourth
#define pii pair<int,int>
#define pll pair<ll,ll>
#define ldb double
#define endl "\n"
string guess_sequence(int n)
{
string rez;
if(n==1)
{
if(press("A")) return "A";
if(press("B")) return "B";
if(press("X")) return "X";
return "Y";
}
if(press("AB"))
{
if(press("A"))
{
rez="A";
for(int i=1;i<n-1;i++)
{
int x=press(rez+"B"+rez+"XB"+rez+"XY"+rez+"XX");
if(x==i) rez=rez+"Y";
else if(x==i+1) rez=rez+"B";
else rez=rez+"X";
}
if(press(rez+"B")==n) return rez+"B";
if(press(rez+"X")==n) return rez+"X";
return rez+"Y";
}
else
{
rez="B";
for(int i=1;i<n-1;i++)
{
int x=press(rez+"A"+rez+"XA"+rez+"XY"+rez+"XX");
if(x==i) rez=rez+"Y";
else if(x==i+1) rez=rez+"A";
else rez=rez+"X";
}
if(press(rez+"A")==n) return rez+"A";
if(press(rez+"X")==n) return rez+"X";
return rez+"Y";
}
}
else
{
if(press("X"))
{
rez="X";
for(int i=1;i<n-1;i++)
{
int x=press(rez+"B"+rez+"AB"+rez+"AY"+rez+"AA");
if(x==i) rez=rez+"Y";
else if(x==i+1) rez=rez+"B";
else rez=rez+"A";
}
if(press(rez+"B")==n) return rez+"B";
if(press(rez+"A")==n) return rez+"A";
return rez+"Y";
}
else
{
rez="Y";
for(int i=1;i<n-1;i++)
{
int x=press(rez+"B"+rez+"XB"+rez+"XA"+rez+"XX");
if(x==i) rez=rez+"A";
else if(x==i+1) rez=rez+"B";
else rez = rez + "X";
}
if(press(rez+"B")==n) return rez+"B";
if(press(rez+"X")==n) return rez+"X";
return rez+"A";
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |