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 = "";
string f = "A";
if(press(ans + "B") == 1)
f = "B";
else if(press(ans + "X") == 1)
f = "X";
else if(press(ans + "Y") == 1)
f = "Y";
ans += f;
vector < string > v , vec = {"A" , "B" , "X" , "Y"};
for(int i = 0 ; i < 4 ; i ++){
auto s = vec.back();
vec.pop_back();
if(s!=f)
v.push_back(s);
}
for(int i = 1 ; i < n ; i ++){
int res = press(ans + v[0] + ans + v[1] + v[0] + ans + v[1] + v[1] + ans + v[1] + v[2]);
if(res == i)
ans += vec[2];
if(res == i + 1)
ans += vec[0];
if(res == i + 2)
ans += vec[1];
}
return(ans);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |