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;
int press (string p);
string guess_sequence(int n) {
char tr, alt, fir;
if (press("AB")) tr = 'A', alt = 'B';
else tr = 'X', alt = 'Y';
string ss = ""; ss += tr;
if (press(ss)) fir = tr;
else fir = alt;
string cs = "ABXY";
cs.erase(cs.find(fir), 1);
string pr = ""; pr += fir;
for (int i=1; i < n-1; i++) {
string s = pr + cs[1] + pr + cs[2]+cs[0] + pr + cs[2]+cs[1] + pr + cs[2]+cs[2];
int res = press(s);
cerr<<res<<endl;
if (res==i) pr += cs[0];
else if (res==i+1) pr += cs[1];
else pr += cs[2];
}
if (press(pr+cs[0])==n) return pr+cs[0];
if (press(pr+cs[1])==n) return pr+cs[1];
return pr+cs[2];
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |