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<bits/stdc++.h>
#include "combo.h"
using namespace std;
string guess_sequence(int n){
char all[4];
int fake=press("AB");
if(fake==0){
fake=press("X");
if(fake==0){
all[0]='Y';
all[1]='A';
all[2]='B';
all[3]='X';
}
else{
all[0]='X';
all[1]='A';
all[2]='Y';
all[3]='B';
}
}
else{
fake=press("A");
if(fake==1){
all[0]='A';
all[1]='B';
all[2]='X';
all[3]='Y';
}
else{
all[0]='B';
all[1]='A';
all[2]='X';
all[3]='Y';
}
}
string res;
int unnow=1;
res.push_back(all[0]);
int now=2;
for(;now<n;){
unnow=now-1;
fake=press(res+all[1]+all[1]+res+all[1]+all[2]+res+all[2]+all[1]);
if(fake==unnow){
res+=all[3];
now++;
continue;
}
else if(fake==unnow+1){
fake=press(res+all[2]+all[2]);
if(fake==unnow+2){
res+=all[2];
res+=all[2];
now+=2;
continue;
}
if(fake==unnow+1){
res+=all[2];
res+=all[3];
now+=2;
continue;
}
res+=all[1];
res+=all[3];
now+=2;
continue;
}
else{
fake=press(res+all[1]+all[1]);
if(fake==unnow){
res+=all[2];
res+=all[1];
now+=2;
continue;
}
else if(fake==unnow+1){
res+=all[1];
res+=all[2];
now+=2;
continue;
}
else{
res+=all[1];
res+=all[1];
now+=2;
continue;
}
}
}
if(now==n){
fake=press(res+all[1]+res+all[2]);
if(fake==n){
fake=press(res+all[1]);
if(fake==n){
res+=all[1];
}
else{
res+=all[2];
}
}
else{
res+=all[3];
}
}
return res;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |