# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
713103 | onepunchac168 | Combo (IOI18_combo) | C++14 | 39 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"
#include <bits/stdc++.h>
using namespace std;
typedef int ll;
std::string guess_sequence(int N) {
string s="";
ll pp=press(s+"A"+s+"B");
if (pp>=1)
{
ll aa=press(s+"A");
if (aa>=1)
{
s+="A";
}
else s+="B";
}
else
{
ll aa=press(s+"X");
if (aa>=1)
{
s+="X";
}
else s+="Y";
}
char a1,a2,a3;
if (s[0]=='A')
{
a1='B';
a2='X';
a3='Y';
}
else if (s[0]=='B')
{
a1='A';
a2='X';
a3='Y';
}
else if (s[0]=='X')
{
a1='A';
a2='B';
a3='Y';
}
else
{
a1='A';
a2='B';
a3='X';
}
if (N==1)
{
return s;
}
for (int i=2;i<=N-1;i++)
{
string gg=s;
gg+=a1;
gg+=s;
gg+=a2;
gg+=a1;
gg+=s;
gg+=a2;
gg+=a2;
gg+=s;
gg+=a2;
gg+=a3;
ll rr=press(gg)-i+1;
if (rr==1)
{
s+=a1;
}
else if (rr==2)
{
s+=a2;
}
else s+=a3;
}
string gg=s;
gg+=a1;
if (press(gg)==N)
{
s=gg;
}
else
{
string tmp=s;
tmp+=a2;
if (press(tmp)==N)
{
s=tmp;
}
else s+=a3;
}
return s;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |