Submission #1230750

#TimeUsernameProblemLanguageResultExecution timeMemory
1230750riddlesCombo (IOI18_combo)C++20
0 / 100
0 ms408 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; typedef long long ll; typedef map<ll, ll> mp; typedef pair<ll, ll> pll; typedef queue<ll> qi; typedef vector<ll> vi; typedef vector<bool> vb; typedef vector<vi> vvi; typedef vector<pll> vpl; typedef vector<string> vs; #define YES cout << "YES\n" #define Yes cout << "Yes\n" #define NO cout << "NO\n" #define No cout << "No\n" #define F first #define S second #define pb push_back #define all(x) begin(x), end(x) ll go() { ll q = press("AB"); if (q >= 1) { q = press("A"); if (q == 1) return 0; else return 1; } else { q = press("X"); if (q == 1) return 2; else return 3; } } string guess_sequence(int N) { string ans = ""; vector<char> idx = {'A', 'B', 'X', 'Y'}; ll a = go(); ans += idx[a]; for (int i = 1; i < N; i++) { string test = ans; if (ans[0] == 'A') { test += "B" + ans + "X" + ans + "Y"; } else if (ans[0] == 'B') { test += "A" + ans + "X" + ans + "Y"; } else if (ans[0] == 'X') { test += "A" + ans + "B" + ans + "Y"; } else { test += "A" + ans + "B" + ans + "X"; } ll k = press(test); if (i == N - 1) { if (k == i) ans += (ans[0] == 'A' ? 'Y' : 'X'); else if (k == i + 1) ans += (ans[0] == 'A' ? 'B' : 'A'); else ans += (ans[0] == 'A' ? 'X' : 'B'); } else { if (k == i + 1) ans += (ans[0] == 'A' ? 'B' : 'A'); else if (k == i + 2) ans += (ans[0] == 'A' ? 'X' : 'B'); else ans += (ans[0] == 'A' ? 'Y' : 'X'); } } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...