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"
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target ("avx2")
#include <bits/stdc++.h>
using namespace std;
typedef long long lo;
typedef pair< lo,lo > PII;
#define fi first
#define se second
#define mp make_pair
#define endl "\n"
#define pb push_back
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(int i=1;i<=n;i++)
#define mid ((start+end)/2)
#define ort ((bas+son)/2)
const lo inf = 1000000000000000000;
const lo KOK = 100000;
const lo LOG = 30;
const lo li = 500005;
const lo mod = 1000000007;
int n,m,b[li],a[li],k,flag,t;
int cev;
string s;
vector<int> v;
std::string guess_sequence(int n) {
string p = "";
p="AB";
int at=press(p);
if(at==0){
p="X";
at=press(p);
if(at==0)s+='Y';
else s+='X';
}
else{
p="A";
at=press(p);
if(at==0)s+='B';
else s+='A';
}
char bir='A';
char iki='B';
char uc='X';
if(n==1)return s;
if(bir==s[0])bir='Y';
if(iki==s[0])iki='Y';
if(uc==s[0])uc='Y';
for(int i=2;i<n;i++){
p={};
if(s[0]!='A'){
p+=s;
p+=bir;
p+='A';
}
if(s[0]!='B'){
p+=s;
p+=bir;
p+='B';
}
if(s[0]!='Y'){
p+=s;
p+=bir;
p+='Y';
}
if(s[0]!='X'){
p+=s;
p+=bir;
p+='X';
}
p+=s;
p+=iki;
at=press(p);
if(at==i-1){
s+=uc;
continue;
}
if(at>=(int)s.size()+2)s+=bir;
else s+=iki;
}
p=s+bir;
p+=s;
p+=iki;
//~ cout<<uc<<endl;
at=press(p);
if(at==n-1){
s+=uc;
}
else{
p=s+bir;
at=press(p);
if(at==n-1)s+=iki;
else s+=bir;
}
return s;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |