# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
831373 | Mularstyle | Combo (IOI18_combo) | C++14 | 23 ms | 404 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) {
string S;
string a;
///FIRST DIGIT
if(press("A")==1)
S="A",a="BXY";
else if(press("B")==1)
S="B",a="AXY";
else if(press("X")==1)
S="X",a="ABY";
else
S="Y",a="ABX";
if(n==1)
return S;
///MIDDLE
int cur=1;
while(S.length()<n-1)
{
int t=press(S+a[0]+S+a[1]+a[0]+S+a[1]+a[1]+S+a[1]+a[2]);
if(t==cur+1)
S+=a[0];
else if(t==cur+2)
S+=a[1];
else
S+=a[2];
}
///FIND LAST DIGIT
if(press(S+"A")==n)
S+="A";
else if(press(S+"B")==n)
S+="B";
else if(press(S+"X")==n)
S+="X";
else if(press(S+"Y")==n)
S+="Y";
return S;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |