Submission #749968

#TimeUsernameProblemLanguageResultExecution timeMemory
749968CDuongCombo (IOI18_combo)C++17
100 / 100
41 ms640 KiB
/* #pragma GCC optimize("Ofast,unroll-loops") #pragma GCC target("avx2,fma,bmi,bmi2,sse4.2,popcnt,lzcnt") */ #include <bits/stdc++.h> #include "combo.h" #define taskname "" #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define ll long long #define ld long double #define pb push_back #define ff first #define ss second #define pii pair<int, int> #define vi vector<int> #define vii vector<pii> using namespace std; const int mxN = 2e5 + 5; const int mod = 1e9 + 7; const ll oo = 1e18; char c[] = {'A', 'B', 'X', 'Y'}; string guess_sequence(int N) { int n = N; int cur = press("AB"); string s; if(cur) { cur = press("A"); if(cur) s = "A"; else s = "B"; } else { cur = press("X"); if(cur) s = "X"; else s = "Y"; } if(n == 1) { return s; } vector<char> sadge; for(int i = 0; i < 4; ++i) if(c[i] != s[0]) sadge.emplace_back(c[i]); for(int i = (int)s.size(); i < n - 1; ++i) { string tmp; tmp += s; tmp.pb(sadge[0]); tmp.pb(sadge[0]); tmp += s; tmp.pb(sadge[0]); tmp.pb(sadge[1]); tmp += s; tmp.pb(sadge[0]); tmp.pb(sadge[2]); tmp += s; tmp.pb(sadge[1]); int cur = press(tmp); if(cur == i) s.pb(sadge[2]); else if(cur - 1 == i) s.pb(sadge[1]); else s.pb(sadge[0]); } string tmp = s; tmp.pb(sadge[0]); if(n == press(tmp)) { s.pb(sadge[0]); return s; } tmp.pop_back(); tmp.pb(sadge[1]); if(n == press(tmp)) { s.pb(sadge[1]); return s; } s.pb(sadge[2]); return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...