제출 #717252

#제출 시각아이디문제언어결과실행 시간메모리
717252BackNoob콤보 (IOI18_combo)C++14
94 / 100
36 ms616 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<char> f({'A', 'B', 'X', 'Y'}); string res = ""; for(int i = 0; i < 3; i++) { string tmp = res + f[i]; if(press(tmp) == 1) { res += f[i]; break; } } if(sz(res) == 0) res += f[3]; char ban = res[0]; vector<char> 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 < 3; j++) { string tmp = res + choose[j]; if(press(tmp) > sz(res)) { res += choose[j]; break; } } if(sz(res) != n) res += choose[3]; } } return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...