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;
#define all(v) v.begin(), v.end()
typedef long long ll;
string str;
int x;
string guess_sequence(int n){
string S;
if(press("AB")){
x = press("A");
S = x ? "A" : "B";
}
else{
x = press("X");
S = x ? "X" : "Y";
}
if(n == 1) return S;
for(auto c : "ABXY")
if(c != S[0]) str.push_back(c);
for(int i = 1; i < n - 1; i++){
string s = S + str[0] + S + str[1] + str[0] + S + str[1] + str[1] + S + str[1] + str[2];
x = press(s);
if(x == i) S += str[2];
else if(x == i + 1) S += str[0];
else str += str[1];
}
x = press(S + str[0]);
if(x == n) S += str[0];
else{
x = press(S + str[1]);
if(x == n) S += str[1];
else S += str[2];
}
return S;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |