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;
string guess_sequence(int n){
string s = "AB", t, d;
if(press(s)){
s = "A";
t = press(s) ? "A" : "B";
}
else{
s = "X";
t = press(s) ? "X" : "Y";
}
if(n == 1)return t;
for(auto &x : "ABXY")if(x != t[0])d.push_back(x);
for(int i = 1; i < n - 1; i ++){
s = t;
s += d[0];
s += t;
s += d[1];
s += d[0];
s += t;
s += d[1];
s += d[1];
s += t;
s += d[1];
s += d[2];
int res = press(s);
if(res <= i)t += d[2];
else if(res == i + 1)t += d[0];
else t += d[1];
}
s = t;
s += d[0];
if(press(s) == n)return s;
s = t;
s += d[1];
if(press(s) == n)return s;
t += d[2];
return t;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |