# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
340271 | Fysty | Combo (IOI18_combo) | C++14 | 1 ms | 200 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 <bits/stdc++.h>
using namespace std;
int press(string p);
string guess_sequence(int n)
{
string s="";
if(n==1)
{
if(press("A")) return "A";
else if(press("B")) return "B";
else if(press("X")) return "X";
else return "Y";
}
int k=press("AB");
if(k)
{
if(press("AA")) s="A";
else s="B";
}
else
{
if(press("XX")) s="X";
else s="Y";
}
if(s=="A")
{
while(s.size()<n-1)
{
int t=press(s+"B"+s+"XB"+s+"XX"+s+"XY");
if(t==1) s+="B";
else if(t==2) s+="X";
else s+="Y";
}
if(press(s+"B"+s+"X"))
{
if(press(s+"B")) s+="B";
else s+="X";
}
else s+="Y";
}
if(s=="B")
{
while(s.size()<n-1)
{
int t=press(s+"A"+s+"XA"+s+"XX"+s+"XY");
if(t==1) s+="A";
else if(t==2) s+="X";
else s+="Y";
}
if(press(s+"A"+s+"X"))
{
if(press(s+"A")) s+="A";
else s+="X";
}
else s+="Y";
}
if(s=="X")
{
while(s.size()<n-1)
{
int t=press(s+"B"+s+"AB"+s+"AA"+s+"AY");
if(t==1) s+="B";
else if(t==2) s+="A";
else s+="Y";
}
if(press(s+"B"+s+"A"))
{
if(press(s+"B")) s+="B";
else s+="A";
}
else s+="Y";
}
if(s=="Y")
{
while(s.size()<n-1)
{
int t=press(s+"B"+s+"XB"+s+"XX"+s+"XA");
if(t==1) s+="B";
else if(t==2) s+="X";
else s+="A";
}
if(press(s+"B"+s+"X"))
{
if(press(s+"B")) s+="B";
else s+="X";
}
else s+="A";
}
return s;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |