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;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define pb push_back
#define popb pop_back
#define ff first
#define ss second
const int MOD = 1e9 + 7;
const ll INF = 1e18;
const char but[4] = {'A','B','X','Y'};
string guess_sequence(int n)
{
string p = "";
string s = "";
int fr = -1;
for(int i = 0; i < 4; i ++)
{
string g = p + but[i];
int rep = press(g);
if(rep == 1)
{
fr = i;
s = g;
break;
}
}
int prog = 1;
int last = fr;
for(int i = 1; i < n; i ++)
{
for(int j= 0; j < 4; j ++)
{
if(j == fr || j == last)
continue;
string g = s;
for(int k = i ; k <= n; k++ )
g += but[j];
int tent = press(g);
if(tent > prog)
{
s = "";
for(int k = 0; k < tent; k ++)
s += g[k];
i = tent;
prog = tent;
last = j;
break;
}
}
}
return s;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |