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 <string>
#include <iostream>
using namespace std;
string guess_sequence(int N) {
char possible[] = {'A','B','X','Y'};
string ans = "";
if(press("AB") >= 1){
if(press("A") == 1){
ans = "A";
}else{
ans = "B";
}
}else{
if(press("X") == 1){
ans = "X";
}else{
ans = "Y";
}
}
if(N == 1)
return ans;
// cout << press("AB") << endl;
// cout << press("A") << endl;
// cout << press("X") << endl;
// cout << ans << endl;
int counter = 1;
while(counter < N){
for(int i=0;i<4;i++){
if(ans[0] == possible[i])
continue;
int val = press(ans+string(N-counter,possible[i]));
// cout << "try - " << ans+string(N-counter,possible[i]) << endl;
if(val > counter){
ans = ans + string(val-counter,possible[i]);
counter = val;
break;
}
}
// cout << "ans -> " << ans << endl;
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |