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>
#define tt cin.tie(0), cout.tie(0), ios_base::sync_with_stdio(0)
#define fo freopen((NAME+".INP").c_str(), "r", stdin), freopen((NAME+".OUT").c_str(), "w", stdout)
#define ll long long
#define ull unsigned long long
#define i128 __int128
#define db long double
#define sz(a) ((int)(a).size())
#define pb emplace_back
#define pf emplace_front
#define pob pop_back
#define pof pop_front
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define ins emplace
using namespace std;
const int MOD = 1e9+7, MAXN = 1e5+5;
const string NAME = "";
//int press(string p){
// if(sz(p)>20){
// cout << "TOO BIG";
// exit(0);
// }
// cout << p << endl;
// int x;
// cin >> x;
// return x;
//}
string guess_sequence(int n){
string s,x="ABXY";
if(press("AB")){
if(press("B")) s='B';
else s='A';
}else if(press("X")) s='X';
else s="Y";
for(int i = 0; i<sz(x); ++i)
if(x[i]==s[0]) x.erase(i,1);
while(sz(s)<n){
string query=s+x[0]+x[1]+s+x[0]+x[2]+s+x[1];
int tmp=press(query);
if(tmp==sz(s)+2) s+=x[0];
else if(tmp==sz(s)+1) s+=x[1];
else s+=x[2];
}
return s;
}
//int main()
//{
// cout << guess_sequence(5);
//}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |