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;
vector<string> vec = {"A" , "B" , "X" , "Y"} , valid;
string guess_sequence(int n){
string cur = "";
for(int i = 0 ; i < 3 ; i++){
if(press(vec[i]) == 1){
cur = vec[i];
break;
}
}
if(cur.size() == 0) cur = vec[3];
if(n == 1) return cur;
for(string i : vec){
if(i != cur){
valid.push_back(i);
}
}
for(int i = 1 ; i + 1 < n ; i++){
string ask = cur + valid[1];
for(string j : valid) ask += cur + valid[2] + j;
int res = press(ask);
for(int j = 0 ; j < 3 ; j++){
if(res == i + j) cur += valid[j];
}
}
for(int i = 0 ; i < 2 ; i++){
if(press(cur + valid[i]) == n) return cur + valid[i];
}
return cur + valid[2];
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |