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;
#define ar array
typedef long long ll;
typedef int32_t ii;
//~ #define int ll
#ifndef EVAL
#include "grader.cpp"
#endif
string guess_sequence(ii n) {
string s;
if(press("AB")){
if(press("A")) s = "A";
else s = "B";
} else {
if(press("X")) s = "X";
else s = "Y";
}
string rem, Char = "ABXY";
for(auto x : Char){
if(s[0] != x){
rem.push_back(x);
}
}
assert(rem.size() == 3);
for(int i=2;i<n;i++){
string t = s + rem[0] + s + rem[1] + rem[0] + s + rem[1] + rem[1] + s + rem[1] + rem[2];
int len = press(t);
if(len == i){
s.push_back(rem[0]);
} if(len == i + 1){
s.push_back(rem[1]);
} if(len == i - 1){
s.push_back(rem[2]);
}
}
if(press(string(s + rem[0])) == n){
s.push_back(rem[0]);
} else if(press(string(s + rem[1])) == n){
s.push_back(rem[1]);
} else {
s.push_back(rem[2]);
}
return s;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |