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;
string guess_sequence(int n) {
string ans;
int cnt = press("AB");
if(cnt == 2){
ans = "A";
}
else if(cnt == 1){
ans = (press("A") == 1 ? "A" : "B");
}
else{
ans = (press("C") == 1 ? "C" : "D");
}
string query = "ABXY";
for(int i = 0; i < 4; i++){
if(query[i] == ans[0]){
query.erase(i, 1);
break;
}
}
for(int i = 1; i < n - 1; i++){
int index = press(ans + query[0] + query[0] + ans + query[0] + query[1] + ans + query[0] + query[2] + ans + query[1]);
ans += query[2 - index + int(ans.size())];
}
for(int i = 0; i < 2; i++){
if(press(ans + query[i]) == n){
return ans + query[i];
}
}
return ans + query[2];
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |