# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
764209 | DJeniUp | Combo (IOI18_combo) | C++17 | 28 ms | 456 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;
typedef long long ll;
string res,b,c,d;
string guess_sequence(int n) {
ll r=press("AB");
ll x=1;
if(r==2){
res="AB";
n-=2;
b="B";
c="X";
d="Y";
x=2;
}else if(r==1){
if(press("A")==1){
res="A";
n--;
b="B";
c="X";
d="Y";
}else{
res="B";
n--;
b="A";
c="X";
d="Y";
}
}else{
if(press("X")==1){
res="X";
n--;
b="B";
c="A";
d="Y";
}else{
res="Y";
n--;
b="A";
c="X";
d="B";
}
}
while(n>0){
if(n==1){
r=press(res+b+res+c);
if(r-x==1){
if(press(res+b)-x==1){
res+=b;
n--;
}else{
res+=c;
n--;
}
}else{
res+=d;
n--;
}
}else{
r=press(res+b+c+res+b+d+res+c+b);
if(r-x==0){
res+=d;
n--;
x++;
}else if(r-x==1){
r=press(res+c+c);
if(r-x==2){
res+=c+c;
n-=2;
x+=2;
}else if(r-x==1){
res+=c+d;
n-=2;
x+=2;
}else{
res+=b+b;
n-=2;
x+=2;
}
}else if(r-x==2){
r=press(res+b+c);
if(r-x==2){
res+=b+c;
n-=2;
x+=2;
}else if(r-x==1){
res+=b+d;
n-=2;
x+=2;
}else{
res+=c+b;
n-=2;
x+=2;
}
}
}
}
return res;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |