제출 #1029310

#제출 시각아이디문제언어결과실행 시간메모리
1029310Osplei콤보 (IOI18_combo)C++17
5 / 100
1 ms420 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...