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"
#define mp make_pair
#define pb push_back
#define pii pair<int, int>
typedef long long ll;
typedef long double ld;
using namespace std;
char f[4];
void scramble(string str) {
for(int i = 0; i < 3; i++) f[i] = str[i];
}
std::string guess_sequence(int N) {
string str = "AB";
int k = press(str);
if(k >= 1) {
str = "A";
k = press(str);
if(k == 1) f[3] = 'A', scramble("BXY");
else f[3] = 'B', scramble("AXY");
} else {
str = "Y";
k = press(str);
if(k == 1) f[3] = 'Y', scramble("ABX");
else f[3] = 'X', scramble("ABY");
}
string S; S += f[3];
int len = 1;
while(len < N-1) {
string tmp = S+f[0]+f[1] + S+f[0]+f[2] + S+f[0]+f[0] + S+f[2];
k = press(tmp);
if(k == len+1) S += f[2], len++;
else if(k == len+2) S += f[0], len++;
else S += f[1], len++;
}
string tmp = S + f[0] + S + f[1];
k = press(tmp);
if(k == len+1) {
tmp = S + f[0];
k = press(tmp);
if(k == len+1) return S + f[0];
else return S + f[1];
} return S + f[2];
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |