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 all(v) v.begin(), v.end()
#define pb push_back
#define ss second
#define ff first
#define vt vector
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, int> pdi;
const int inf = 1e9 + 10000;
const int mod = 1e9+7;
const int maxn = 5e5 + 12;
//int press(std::string p) {
//if (++num_moves > MAX_NUM_MOVES) {
//wrong_answer("too many moves");
//}
//int len = p.length();
//if (len > 4 * N) {
//wrong_answer("invalid press");
//}
//for (int i = 0; i < len; ++i) {
//if (p[i] != 'A' && p[i] != 'B' && p[i] != 'X' && p[i] != 'Y') {
//wrong_answer("invalid press");
//}
//}
//int coins = 0;
//for (int i = 0, j = 0; i < len; ++i) {
//if (j < N && S[j] == p[i]) {
//++j;
//} else if (S[0] == p[i]) {
//j = 1;
//} else {
//j = 0;
//}
//coins = std::max(coins, j);
//}
//return coins;
//}
string guess_sequence(int n){
string s = "", a = "";
int wt = press("AB");
if(wt) {
wt = press("A");
if(wt)s = "A", a = "BXY";
else s = "B", a = "AXY";
}
else {
wt = press("X");
if(wt)s = "X", a = "ABY";
else s = "Y", a = "ABX";
}
if(n == 1)return s;
for(int i = 1; i < n - 1; i++) {
wt = press(s + a[0] + s + a[1] + a[0] + s + a[1] + a[1] + s + a[1] + a[2]);
if(wt == i)s += a[2];
else if(wt == i + 1)s += a[0];
else if(wt == i + 2)s += a[1];
}
wt = press(s + a[0] + s + a[1]);
if(wt == n){
wt = press(s + a[0]);
if(wt == n)s += a[0];
else 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... |