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 F first
#define S second
#define SZ(a) ((int)(a).size())
#define PB push_back
#define ALL(a) (a).begin(), (a).end()
using namespace std;
typedef long long ll;
typedef pair<ll, ll> ii;
std::string guess_sequence(int n) {
std::string p = "AB";
int c = press(p);
if(!c){
p="XY";
c=press(p);
}
std::string s;
if(c==2)
s=p;
else
if(c==1){
c=press(p.substr(0,1));
if(c)
s+=p[0];
else
s+=p[1];
}
std::vector<char> a;
for(auto x: {'A','B','X','Y'})
if(s[0]!=x)
a.PB(x);
while (SZ(s)<n) {
p=s+a[0];
c=press(p);
if(c==SZ(p)){
s+=a[0];
continue;
}
p=s+a[1];
c=press(p);
if(c==SZ(p))
s+=a[1];
else
s+=a[2];
}
return s;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |