Submission #1020192

#TimeUsernameProblemLanguageResultExecution timeMemory
1020192mansurCombo (IOI18_combo)C++17
30 / 100
27 ms1968 KiB
#include "combo.h" #include<bits/stdc++.h> using namespace std; #define rall(s) s.rbegin(), s.rend() #define all(s) s.begin(), s.end() #define sz(s) (int)s.size() #define s second #define f first using ll = long long; using pii = pair<int, int>; using pll = pair<ll, ll>; mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); const int N = 1e6; string guess_sequence(int n) { string ans = ""; if (press("AB")) { if (press("A")) ans = "A"; else ans = "B"; }else { if (press("X")) ans = "X"; else ans = "Y"; } vector<char> s, h; if (ans != "A") s.push_back('A'); if (ans != "B") s.push_back('B'); if (ans != "X") s.push_back('X'); if (ans != "Y") s.push_back('Y'); while (sz(ans) < n) { shuffle(all(s), rng); if (sz(h)) { if (sz(ans) == n - 1) { if (press(ans + h[0]) == sz(ans)) ans += h[1]; else ans += h[0]; return ans; } int x = press(ans + h[0] + s[0] + ans + h[0] + s[1]); if (x == sz(ans) + 2) { ans += h[0]; h = {s[0], s[1]}; continue; } if (x == sz(ans) + 1) { ans = ans + h[0] + s[2]; h.clear(); continue; } ans += h[1]; h.clear(); continue; } if (sz(ans) == n - 1) { if (press(ans + s[0] + ans + s[1]) == sz(ans) + 1) { if (press(ans + s[0]) == sz(ans) + 1) ans += s[0]; else ans += s[1]; }else ans += s[2]; return ans; } int x = press(ans + s[0] + s[0] + ans + s[0] + s[1] + ans + s[1] + s[0] + ans + s[1] + s[1]); if (x == sz(ans)) { ans += s[2]; continue; } if (x == sz(ans) + 1) { if (press(ans + s[0]) == sz(ans)) ans = ans + s[1] + s[2]; else ans = ans + s[0] + s[2]; continue; } x = press(ans + s[0] + s[0]); if (x == sz(ans)) { ans += s[1]; h = {s[0], s[1]}; continue; } if (x == sz(ans) + 2) ans = ans + s[0] + s[0]; else ans = ans + s[0] + s[1]; } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...