# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
831378 | Mularstyle | Combo (IOI18_combo) | C++14 | 27 ms | 536 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("AB")>0){
if(press("A")>0)
S="A",a="BXY";
else
S="B",a="AXY";
}
else{
if(press("X")>0)
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];
cur++;
}
///FIND LAST DIGIT
if(press(S+"A"+S+"B")==n)
{
if(press(S+"A")==n)
S+="A";
else
S+="B";
}
else
{
if(press(S+"X")==n)
S+="X";
else
S+="Y";
}
return S;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |