# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
908547 | dragusanu_rares | Combo (IOI18_combo) | C++14 | 14 ms | 2124 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 <iostream>
#include "combo.h"
using namespace std;
#define P press
string guess_sequence(int n){
if(n==1){
if(P("X"))return "X";
if(P("Y"))return "Y";
if(P("A"))return "A";
return "B";
}
char F,a,b,c;
string S;
if(P("XY")){
a='A';
b='B';
if(P("X"))F='X';
else F='Y';
c='X'+'Y'-F;
}
else{
b='X';
c='Y';
if(P("A"))F='A';
else F='B';
a='A'+'B'-F;
}
S=F;
while(S.size()<n-1){
string G=S+b+S+c+a+S+c+b+S+c+c;
int x=P(G)-S.size();
if(!x)S+=a;
else if(x&1)S+=b;
else S+=c;
}
if(P(S+a)==n)return S+a;
if(P(S+b)==n)return S+b;
return S+c;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |