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 guess_sequence(int N) {
string S = "";
if(press("AB")) S += (press("A") ? 'A' : 'B');
else if(press("X")) S = "X";
else S = "Y";
vector<char> st;
for(char ch : {'A', 'B', 'X', 'Y'})
if(ch != S[0]) st.push_back(ch);
for(int i=1; i<N; i++) {
string S2 = S + st[0] + S + st[1];
int ans = press(S2);
if(ans == i + 1) {
if(press(S + st[0]) == i + 1) S += st[0];
else S += st[1];
} else if(ans == i) {
S += st[2];
} else {
string S3 = S;
S += st[0];
for(int j=0; j<ans-i-1; j++) S += S3[j];
}
}
return S;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |