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 pb push_back
using namespace std;
string guess_sequence(int n)
{
string res = "";
char c[] = {'A', 'B', 'X', 'Y'};
if(press("AB")) {
if(press("A")) res.pb('A');
else res.pb('B'), swap(c[0], c[1]);
} else {
if(press("X")) res.pb('X'), swap(c[0], c[2]);
else res.pb('Y'), swap(c[0], c[3]);
}
for(int i = 2; i < n; ++i) {
int len = press(res + c[1] + c[1] + res + c[1] + c[2] + res + c[1] + c[3] + res + c[2]);
if(len == i + 1) res.pb(c[1]);
else if(len == i) res.pb(c[2]);
else res.pb(c[3]);
}
if(n - 1) {
if(press(res + c[1]) == n) res.pb(c[1]);
else if(press(res + c[2]) == n) res.pb(c[2]);
else res.pb(c[3]);
}
return res;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |