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){
string res = "A";
vector<char> a = {'B', 'X', 'Y'};
if(press("B")) res = "B", a = {'A', 'X', 'Y'};
if(press("X")) res = "X", a = {'A', 'B', 'Y'};
if(press("Y")) res = "Y", a = {'A', 'B', 'X'};
for(int i = 1; i < N - 1; i ++){
string t;
t += (res + a[0]);
t += (res + a[1] + a[0]);
t += (res + a[1] + a[1]);
t += (res + a[1] + a[2]);
int x = press(t);
int sz = (int)res.size();
if(x == sz + 1) res += a[0];
else if(x == sz + 2) res += a[1];
else res += a[2];
}
if(N > 1){
string t;
t += res + a[0];
t += res + a[1];
if(press(t) == N){
t = res + a[0];
if(press(t) == N) res += a[0];
else res += a[1];
}
else{
res += a[2];
}
}
return res;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |