# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
908541 | dragusanu_rares | Combo (IOI18_combo) | C++14 | 13 ms | 1968 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")==1)return "X";
else if(P("Y")==1)return "Y";
else if(P("A")==1)return "A";
else return "B";
}
else{
char ch1,a,b,c;
string S;
if(P("XY")>=1){
if(P("X")==1)ch1='X';
else ch1='Y';
}
else{
if(P("A")==1)ch1='A';
else ch1='B';
}
S=ch1;
if(ch1=='A'){
a='B';
b='X';
c='Y';
}
else if(ch1=='B'){
a='A';
b='X';
c='Y';
}
else if(ch1=='X'){
a='A';
b='B';
c='Y';
}
else{
a='A';
b='B';
c='X';
}
while(S.size()<n-1){
string guess=S+b+S+c+a+S+c+b+S+c+c;
int x=P(guess)-S.size();
if(x==0)S.push_back(a);
else if(x==1)S.push_back(b);
else S.push_back(c);
}
if(P(S+a)==n)return S+a;
else if(P(S+b)==n)return S+b;
else return S+c;
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |