이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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';
}
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... |