This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// Be name khode //
#include "combo.h"
#include <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(), x.end()
#define pb push_back
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
const int maxn5 = 5e5 + 10;
const int lg = 20;
string s[4];
char a[4];
std::string guess_sequence(int n) {
string c[4] = {"A", "B", "X", "Y"};
string t = c[0] + c[1];
if(press(t)){
t = c[0];
if(press(t))
swap(c[0], c[3]);
else
swap(c[1], c[3]);
}
else{
t = c[2];
if(press(t))
swap(c[2], c[3]);
}
for(int i = 0; i < 4; i++){
a[i] = c[i][0];
s[i] = c[3];
}
if(n == 1)
return s[0];
//cout << s[0] << endl;
for(int i = 1; i < n - 1; i++){
s[0].pb(a[0]);
s[1].pb(a[0]);
s[2].pb(a[0]);
s[3].pb(a[1]);
s[0].pb(a[0]);
s[1].pb(a[1]);
s[2].pb(a[2]);
string t = s[0] + s[1] + s[2] + s[3];
//cout << t << endl;
int w = press(t);
//cout << w << endl;
if(w == i){
for(int i = 0; i < 3; i++)
s[i].pop_back();
for(int i = 0; i < 4; i++)
s[i].pop_back();
for(int i = 0; i < 4; i++)
s[i].pb(a[2]);
}
else if(w == i + 1){
for(int i = 0; i < 3; i++){
s[i].pop_back();
s[i].pop_back();
s[i].pb(a[1]);
}
}
else{
for(int i = 0; i < 4; i++)
s[i].pop_back();
s[3].pb(a[0]);
}
}
t = s[0] + c[0] + s[0] + c[1];
if(press(t) == n){
t = s[0] + c[0];
if(press(t) == n)
return t;
else{
t = s[0] + c[1];
return t;
}
}
else{
t = s[0] + c[2];
if(press(t) == n)
return t;
else{
t = s[0] + c[3];
return t;
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |