이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "combo.h"
#include<bits/stdc++.h>
using namespace std;
int n,num;
char s[3];
string a,b,x,y,ans,test;
std::string guess_sequence(int N) {
n=N;
a.push_back('A');
b.push_back('B');
x.push_back('X');
y.push_back('Y');
if(press(a)==1)
{
ans.push_back(a[0]);
s[0]=b[0];
s[1]=x[0];
s[2]=y[0];
}else if(press(b)==1)
{
ans.push_back(b[0]);
s[0]=a[0];
s[1]=x[0];
s[2]=y[0];
}else if(press(x)==1)
{
ans.push_back(x[0]);
s[0]=a[0];
s[1]=b[0];
s[2]=y[0];
}else
{
ans.push_back(y[0]);
s[0]=a[0];
s[1]=b[0];
s[2]=x[0];
}
for(int i=1;i<n-1;i++)
{
test+=(ans);
test.push_back(s[0]);
test+=(ans);
test.push_back(s[1]);
test.push_back(s[0]);
test+=(ans);
test.push_back(s[1]);
test.push_back(s[1]);
test+=(ans);
test.push_back(s[1]);
test.push_back(s[2]);
num=press(test);
if(num==i+2)
{
ans.push_back(s[1]);
}else if(num==i+1)
{
ans.push_back(s[0]);
}else
{
ans.push_back(s[2]);
}
test.clear();
}
test+=(ans);
test.push_back(s[0]);
if(press(test)==n)
{
ans.push_back(s[0]);
}else
{
test.clear();
test+=(ans);
test.push_back(s[1]);
if(press(test)==n)
{
ans.push_back(s[1]);
}else
{
ans.push_back(s[2]);
}
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |