# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
869765 | Ninedesu | Combo (IOI18_combo) | C++14 | 1 ms | 424 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;
int st,sti=1;
string t="ABXY";
string guess_sequence(int N) {
string p = "ABX";
int c=press(p);
if(c==3){
st=0;
sti=3;
if(N==3)return p;
}
else if(c==2){
sti=2;
p="AB";
c=press(p);
if(c==2)st=0;
else{
st=1;
p="BX";
}
if(N==2)return p;
}
else if(c==1){
p="AB";
c=press(p);
if(c==1){
p="A";
c=press(p);
if(c==1)st=0;
else{
p="B";
st=1;
}
}
else{
p="X";
st=2;
}
}
else{
p="Y";
st=3;
}
if(N==1)return p;
for(int i=sti; i<N-1; i++){
string q="";
int x=0;
if(x==st)x++;
for(int j=0; j<4; j++){
if(st==j)continue;
q+=p+t[x]+t[j];
}
x++;
if(x==st)x++;
q+=p+t[x];
x++;
if(x==st)x++;
c=press(q);
if(c==p.size()+2)p+=q[p.size()];
else if(c==p.size()+1)p+=q[q.size()-1];
else p+=t[x];
}
string q;
int x=0;
for(int i=1; i<=2; i++,x++){
if(x==st)x++;
q+=p+t[x];
}
c=press(q);
if(c==N){
int y=0;
if(y==st)y++;
q=p+t[y];
c=press(q);
if(c==N)return q;
else{
y++;
if(y==st)y++;
return p+t[y];
}
}
else return p+t[x];
return p;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |