# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
770718 | AtinaR | Combo (IOI18_combo) | C++14 | 0 ms | 208 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 possible[3];
if(first=='X')
{
possible[0]='A';
possible[1]='B';
possible[2]='Y';
}
else if(first=='Y')
{
possible[0]='A';
possible[1]='B';
possible[2]='X';
}
else if(first=='A')
{
possible[0]='X';
possible[1]='B';
possible[2]='Y';
}
else if(first=='B')
{
possible[0]='A';
possible[1]='X';
possible[2]='Y';
}
while((int)res.size()<N-1)
{
string cnt=res+possible[0]+ res+possible[1]+possible[0] + res+possible[1]+possible[1] + res+possible[1]+possible[2];
int tmp=press(cnt);
if(tmp==1)
{
res+=possible[0];
}
else if(tmp>=2)
{
res+=possible[1];
}
else if(tmp==0)
{
res+=possible[2];
}
}
int tmp;
if(press(res+possible[0])==N)
{
res+=possible[0];
}
else if(press(res+possible[1])==N)
{
res+=possible[1];
}
else
{
res+=possible[2];
}
return res;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |