Submission #600643

#TimeUsernameProblemLanguageResultExecution timeMemory
600643vovikCombo (IOI18_combo)C++17
100 / 100
36 ms656 KiB
//I wrote this code 4 u today #include <bits/stdc++.h> #define vc vector #define nd node* #define pnd pair<nd, nd> using namespace std; typedef long long ll; typedef vector<ll> vll; typedef pair<ll, ll> pll; typedef vc<pll> vpll; typedef vc<vll> vvll; typedef vc<vpll> vvpll; template<const ll MOD> struct mod_mul : std::multiplies<const ll> { ll operator()(const ll a, const ll b) { return (a * b) % MOD; } }; template<typename T> inline void sort(T &a) { sort(a.begin(), a.end()); } template<typename T> inline void unique(T &a) { a.resize(unique(a.begin(), a.end()) - a.begin()); } template<typename T> inline void reverse(T &a) { reverse(a.begin(), a.end()); } const ll INF = 9023372036854775808ll; const ll MOD = 1000000007ll; int press(string p); string guess_sequence(int N) { string s; if (press("XY")) if (press("X")) s = "X"; else s = "Y"; else if (press("A")) s = "A"; else s = "B"; if (N == 1) return s; vc<string> ku; {string tmp;tmp.push_back(' '); for (auto ch : string{"ABXY"}) if (ch != s[0]) tmp[0] = ch, ku.push_back(tmp);} for (int i = 1; i + 1 < N; ++i) { int c = press(s+ku[0]+ku[0]+s+ku[0]+ku[1]+s+ku[0]+ku[2]+s+ku[1]); s += ku[(s.size() + 2) - c]; } if (press(s+ku[0]+s+ku[1]) == N) if (press(s+ku[0]) == N) s += ku[0]; else s += ku[1]; else s += ku[2]; return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...