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;
string vt, st;
pair<int, int>ds[3]{{0, 1}, {0, 2}, {1, 2}};
string s[3];
int k, mask;
std::string guess_sequence(int n) {
string ans;
k = press("AB");
if (k == 2)
ans = "AB";
else{
if (k == 1){
if (press("A"))
ans = "A";
else
ans = "B";
}
else{
if (press("X"))
ans = "X";
else
ans = "Y";
}
}
// if (n == 1)
// return ans;
vt = {'A', 'B', 'X', 'Y'};
for (int i = 0; i < 4; i++)
if (vt[i] == ans[0]){
vt.erase(vt.begin() + i);
break;
}
mask = vt[0] ^ vt[1] ^ vt[2];
char a = vt[0], b = vt[1], c = vt[2];
while ((int)ans.size() < n){
int sz = ans.size();
if (n - (int)ans.size() == 1){
if (press(ans + a) == n)
return ans + a;
else{
if(press(ans + b) == n)
return ans + b;
return ans + c;
}
}
int op = press(ans + a + ans + b + a + ans + b + b + ans + b + c);
if (op == sz)
ans = ans + c;
else{
if (op - sz == 1)
ans = ans + a;
else
ans = ans + b;
}
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |