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 <random>
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
const ll maxn = 2e3 + 1;
vector<char> v = {'A', 'B', 'X', 'Y'};
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
string guess_sequence(int n) {
string pref = "";
int get = press("AB");
if (get > 0){
get = press("A");
if (get == 1){
pref += "A";
}
else{
pref += "B";
}
}
else{
get = press("X");
if (get == 1){
pref += "X";
}
else{
pref += "Y";
}
}
vector<char> v2;
for (auto it : v){
if (it != pref[0]){
v2.pb(it);
}
}
for (int i = 2; i <= n; ){
if (i == n){
string npref = pref + v2[0] + pref + v2[1];
get = press(npref) - i + 1;
if (get == 1){
npref = pref + v2[0];
get = press(npref) - i + 1;
if (get == 1){
pref += v2[0];
}
else{
pref += v2[1];
}
}
else{
pref += v2[2];
}
break;
}
string npref = pref + v2[0] + v2[0] + pref + v2[1] + v2[1] + pref + v2[0] + v2[1];
get = press(npref);
int kol = get - i + 1;
if (kol == 2){
npref = pref + v2[0] + v2[0];
get = press(npref);
int kol2 = get - i + 1;
if (kol2 == 2){
pref += v2[0];
pref += v2[0];
i += 1;
i += 1;
}
else if (kol2 == 1){
pref += v2[0];
pref += v2[1];
i += 1;
i += 1;
}
else{
pref += v2[1];
pref += v2[1];
i += 1;
i += 1;
}
}
else if (kol == 1){
npref = pref + v2[1] + v2[2];
get = press(npref);
int kol2 = get - i + 1;
if (kol2 == 2){
pref += v2[1];
pref += v2[2];
i += 1;
i += 1;
}
else if (kol2 == 1){
pref += v2[1];
pref += v2[0];
i += 1;
i += 1;
}
else{
pref += v2[0];
pref += v2[2];
i += 1;
i += 1;
}
}
else{
pref += v2[2];
i += 1;
}
}
return pref;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |