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 mp make_pair
#define pb push_back
#define fi first
#define se second
string guess_sequence(int N) {
string ans = "";
char arr[4] = {'A', 'B', 'X', 'Y'};
vector<char> listPos;
if(press("AB") >= 1) {
if(press("A") == 1) {
ans = "A";
}
else {
ans = "B";
}
}
else {
if(press("X") == 1) {
ans = "X";
}
else {
ans = "Y";
}
}
if(N == 1) return ans;
for(int i = 0; i < 4; i++) {
if(arr[i] != ans[0]) listPos.pb(arr[i]);
}
for(int i = 2; i < N; i++) {
string query = ans + listPos[0];
query += ans + listPos[1] + listPos[0];
query += ans + listPos[1] + listPos[1];
query += ans + listPos[1] + listPos[2];
int res = press(query);
if(res == i - 1) ans += listPos[2];
else if(res == i) ans += listPos[0];
else ans += listPos[1];
}
int cnt = 0;
for(int i = 0; i < 3; i++) {
cnt++;
if(cnt == 3 || press(ans + listPos[i]) == N) {
ans += listPos[i];
return ans;
}
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |