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 button[] = {"A","B","X","Y"};
string guess_sequence(int N) {
string S = "";
int met = -1;
if(press(button[0] + button[1]) != 0) {
if(press(button[0])) met = 0;
else met = 1;
} else {
if(press(button[2])) met = 2;
else met = 3;
}
//cerr << ":: " << met << endl;
S+=button[met];
if(N==1) return S;
vector<string> p;
for(int i=0; i<4; i++) {
if(i!=met) p.push_back(button[i]);
}
int cnt = 3;
for(int k=1; k<N-1; k++) {
string T = "";
for(int i=0; i<3; i++) {
T += S + p[0] + p[i];
}
T += S + p[1];
int ask = press(T);
//cerr << "press " << T << endl;
S += p[k + 2 - ask];
cnt++;
}
if(press(S + p[0]) == N) S += p[0];
else if (press(S + p[1]) == N) S += p[1];
else S += p[2];
// cout << N << " " << cnt << endl;
//cerr << "my guess = " << S << endl;
return S;
}
/*
N-1
1 kali nanya nebak 1 huruf
2 kali nanya tp nebak 2 huruf
*/
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |