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"
using namespace std;
typedef pair<int,int> ii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<vii> wgraf;
typedef pair<int,ii> edge;
typedef vector <ll> vl;
typedef pair <ll, ll> LL;
typedef vector <LL> vll;
#define UNVISITED 0
#define VISITED 1
#define pb push_back
#define F first
#define S second
string guess_sequence(int N){
ll k = 0, aux;
string ans = "", act;
act = "XA";
aux = press(act);
if (aux != 0) {
act = "X";
aux = press(act);
if (aux != 0) ans += 'X';
else ans += 'A';
} else {
act = "B";
aux = press(act);
if (aux != 0) ans += 'B';
else ans += 'Y';
}
if (N == 1) return ans;
k = 1;
for (ll i = 1; i < N - 1; i++) {
act = ans;
if (ans[0] == 'X') {
act += 'A';
act += 'A';
act += ans;
act += 'A';
act += 'B';
act += ans;
act += 'A';
act += 'Y';
act += ans;
act += 'B';
aux = press(act);
if (aux == k + 2) ans += 'A';
else if (aux == k + 1) ans += 'B';
else ans += 'Y';
} else if (ans[0] == 'A') {
act += 'X';
act += 'X';
act += ans;
act += 'X';
act += 'B';
act += ans;
act += 'X';
act += 'Y';
act += ans;
act += 'B';
aux = press(act);
if (aux == k + 2) ans += 'X';
else if (aux == k + 1) ans += 'B';
else ans += 'Y';
} else if (ans[0] == 'B') {
act += 'A';
act += 'A';
act += ans;
act += 'A';
act += 'X';
act += ans;
act += 'A';
act += 'Y';
act += ans;
act += 'X';
aux = press(act);
if (aux == k + 2) ans += 'A';
else if (aux == k + 1) ans += 'X';
else ans += 'Y';
} else {
act += 'A';
act += 'A';
act += ans;
act += 'A';
act += 'B';
act += ans;
act += 'A';
act += 'X';
act += ans;
act += 'B';
aux = press(act);
if (aux == k + 2) ans += 'A';
else if (aux == k + 1) ans += 'B';
else ans += 'X';
}
k++;
}
if (ans[0] == 'X'){
act = ans;
act += 'A';
act += ans;
act += 'B';
aux = press(act);
if (aux >= N) {
act = ans;
act += 'A';
aux = press(act);
if (aux == N) {
ans += 'A';
return ans;
} else {
ans += 'B';
return ans;
}
} else {
ans += 'Y';
return ans;
}
} else if (ans[0] == 'A'){
act = ans;
act += 'X';
act += ans;
act += 'B';
aux = press(act);
if (aux >= N) {
act = ans;
act += 'X';
aux = press(act);
if (aux == N) {
ans += 'X';
return ans;
} else {
ans += 'B';
return ans;
}
} else {
ans += 'Y';
return ans;
}
} else if (ans[0] == 'B'){
act = ans;
act += 'A';
act += ans;
act += 'X';
aux = press(act);
if (aux >= N) {
act = ans;
act += 'A';
aux = press(act);
if (aux == N) {
ans += 'A';
return ans;
} else {
ans += 'X';
return ans;
}
} else {
ans += 'Y';
return ans;
}
} else {
act = ans;
act += 'A';
act += ans;
act += 'B';
aux = press(act);
if (aux >= N) {
act = ans;
act += 'A';
aux = press(act);
if (aux == N) {
ans += 'A';
return ans;
} else {
ans += 'B';
return ans;
}
} else {
ans += 'X';
return ans;
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |