Submission #717255

#TimeUsernameProblemLanguageResultExecution timeMemory
717255BackNoobCombo (IOI18_combo)C++14
100 / 100
35 ms580 KiB
#include "combo.h" #include <bits/stdc++.h> #define ll long long #define fi first #define se second #define endl '\n' #define MASK(i) (1LL << (i)) #define ull unsigned long long #define ld long double #define pb push_back #define all(x) (x).begin() , (x).end() #define BIT(x , i) ((x >> (i)) & 1) #define TASK "task" #define sz(s) (int) (s).size() using namespace std; const int mxN = 5e5 + 227; const int inf = 1e9 + 277; const int mod = 1e9 + 7; const ll infll = 1e18 + 7; const int base = 307; const int LOG = 20; template <typename T1, typename T2> bool minimize(T1 &a, T2 b) { if (a > b) {a = b; return true;} return false; } template <typename T1, typename T2> bool maximize(T1 &a, T2 b) { if (a < b) {a = b; return true;} return false; } string guess_sequence(int n) { vector<string> f({"A", "B", "X", "Y"}); string res = ""; string t1 = ""; string t2 = ""; string ban; t1 += f[0] + f[1]; t2 += f[2] + f[3]; if(press(t1) > 0) { string tmp = ""; tmp += f[0]; if(press(tmp) > 0) res = ban = f[0]; else res = ban = f[1]; } else { string tmp = ""; tmp += f[2]; if(press(tmp) > 0) res = ban = f[2]; else res = ban = f[3]; } vector<string> choose; for(int i = 0; i < 4; i++) if(f[i] != ban) choose.pb(f[i]); for(int i = 2; i <= n; i++) { if(i != n) { string tmp = ""; tmp += res + choose[0] + choose[0]; tmp += res + choose[0] + choose[1]; tmp += res + choose[0] + choose[2]; tmp += res + choose[1]; int x = press(tmp); if(x == sz(res)) res += choose[2]; else if(x == sz(res) + 1) res += choose[1]; else res += choose[0]; } else { for(int j = 0; j < 2; j++) { string tmp = res + choose[j]; if(press(tmp) > sz(res)) { res += choose[j]; break; } } if(sz(res) != n) res += choose[2]; } } return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...