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-1 ; 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 += v[2];
if(res == i + 1)
ans += v[0];
if(res == i + 2)
ans += v[1];
}
if(n == 1)return(ans);
f = v[0];
if(press(ans + v[1]) == n)
f = "B";
else if(press(ans + v[2]) == n)
f = "X";
ans += f;
return(ans);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |