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;
string guess_sequence(int n){
int i, j;
string s, sol;
char c[5] = "ABXY";
s = c[0];
s += c[1];
if(press(s) > 0){
s = c[1];
if(press(s) == 1){
swap(c[0], c[1]);
}
}
else{
s = c[2];
if(press(s) == 1){
swap(c[0], c[2]);
}
else{
swap(c[0], c[3]);
}
}
sol = c[0];
if(n == 1){
return sol;
}
for(i = 2; i < n; i++){
s = sol;
s += c[1];
for(j = 1; j < 4; j++){
s += sol;
s += c[2];
s += c[j];
}
int x = press(s);
if(x == i - 1){
sol += c[3];
}
else{
if(x == i){
sol += c[1];
}
else{
sol += c[2];
}
}
}
s = sol;
s += c[1];
if(press(s) == n){
sol += c[1];
}
else{
s = sol;
s += c[2];
if(press(s) == n){
sol += c[2];
}
else{
sol += c[3];
}
}
return sol;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |