# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
770726 | AtinaR | Combo (IOI18_combo) | C++14 | 25 ms | 516 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"
#include <bits/stdc++.h>
using namespace std;
std::string guess_sequence(int N)
{
char first;
int f=press("AB");
if(f>=1)
{
f=press("A");
if(f>=1)
{
first='A';
}
else
{
first='B';
}
}
else
{
f=press("X");
if(f>=1)
{
first='X';
}
else first='Y';
}
string res="";
res+=first;
char a,b,c;
if(first=='X')
{
a='A';
b='B';
c='Y';
}
else if(first=='Y')
{
a='A';
b='B';
c='X';
}
else if(first=='A')
{
a='X';
b='B';
c='Y';
}
else if(first=='B')
{
a='A';
b='X';
c='Y';
}
if(N==1)
return res;
for(int sz=1; sz<N-1; sz++)
{
string cnt=res+a+ res+b+a + res+b+b + res+b+c;
int tmp=press(cnt);
if(tmp==sz+1)
{
res+=a;
}
else if(tmp==sz+2)
{
res+=b;
}
else if(tmp==sz)
{
res+=c;
}
}
int tmp;
if(press(res+a)==N)
{
res+=a;
}
else if(press(res+b)==N)
{
res+=b;
}
else
{
res+=c;
}
return res;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |