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){
char init;
if(press("AB") >= 1){
if(press("A") == 1) init = 'A';
else init = 'B';
}
else{
if(press("X") == 1) init = 'X';
else init = 'Y';
}
if(N == 1){
string tmp(1, init);
return tmp;
}
string s(N * 4, init);
vector<char> v;
if(init != 'A') v.push_back('A');
if(init != 'B') v.push_back('B');
if(init != 'X') v.push_back('X');
if(init != 'Y') v.push_back('Y');
for(int i = 1; i < N - 1; i++){
s[i] = v[0];
s[N + i] = v[0];
s[N * 2 + i] = v[0];
s[N * 3 + i] = v[1];
s[i + 1] = v[0];
s[N + i + 1] = v[1];
s[N * 2 + i + 1] = v[2];
int ret = press(s);
int c;
if(ret == i + 2) c = 0;
else if(ret == i + 1) c = 1;
else c = 2;
for(int j = 0; j < 4; j++) s[N * j + i] = v[c];
}
int c2;
s[N * 2 - 1] = s[N * 3 - 1] = s[N * 4 - 1] = init;
s[N - 1] = v[0];
if(press(s) == N) c2 = 0;
else{
s[N - 1] = v[1];
if(press(s) == N) c2 = 1;
else c2 = 2;
}
s[N - 1] = v[c2];
string ans(N, init);
for(int i = 0; i < N; i++) ans[i] = s[i];
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |