# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
571042 | mihai145 | Combo (IOI18_combo) | C++14 | 37 ms | 576 KiB |
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"
std::string guess_sequence(int N) {
std::string p = "";
if(press("AB")==0)
{
if(press("X")==1)
p+="X";
else
p+="Y";
}
else
{
if(press("A")==1)
p+="A";
else
p+="B";
}
if(N == 1) return p;
char v[3]={0};
if(p[0]=='A')
{
v[0]='B';
v[1]='X';
v[2]='Y';
}
if(p[0]=='B')
{
v[0]='A';
v[1]='X';
v[2]='Y';
}
if(p[0]=='X')
{
v[0]='B';
v[1]='A';
v[2]='Y';
}
if(p[0]=='Y')
{
v[0]='B';
v[1]='X';
v[2]='A';
}
for(int i=2;i<=N-1;i++)
{
int ans=press(p+v[0]+v[0]+p+v[0]+v[1]+p+v[0]+v[2]+p+v[1]);
if(ans==p.size())
p+=v[2];
else
if(ans==p.size()+1)
p+=v[1];
else
p+=v[0];
}
if(press(p+v[0])==N-1)
{
if(press(p+v[1])==N)
p+=v[1];
else
p+=v[2];
}
else
p+=v[0];
return p;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |