# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1029305 | Osplei | 콤보 (IOI18_combo) | C++17 | 0 ms | 0 KiB |
이 제출은 이전 버전의 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;
aux = press("XA");
if (aux != 0) {
aux = press("X");
if (aux != 0) ans += 'X';
else ans += 'A';
} else {
aux = press("B");
if (aux != 0) ans += 'B';
else ans += 'Y';
}
k = 1;
for (ll i = 0; 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;
}
}
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t = 1;
//cin >> t;
}