Submission #1252107

#TimeUsernameProblemLanguageResultExecution timeMemory
1252107SoMotThanhXuanCombo (IOI18_combo)C++20
100 / 100
7 ms484 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; #define F first #define S second #define FOR(i, a, b) for(int i = (a), _b = (b); i <= _b; ++i) #define REP(i, a, b) for(int i = (a), _b = (b); i >= _b; --i) #define mp make_pair #define all(v) v.begin(), v.end() #define uni(v) v.erase(unique(all(v)), v.end()) #define Bit(x, i) ((x >> (i)) & 1) #define Mask(i) (1 << (i)) #define Cnt(x) __builtin_popcount(x) #define Cntll(x) __builtin_popcountll(x) #define Ctz(x) __builtin_ctz(x) // so luong so 0 tinh tu ben phai #define Ctzll(x) __builtin_ctzll(x) #define Clz(x) __builtin_clz(x) // so luong so 0 tinh tu ben trai #define Clzll(x) __builtin_clzll(x) inline bool maximize(int &u, int v){ return v > u ? u = v, true : false; } inline bool minimize(int &u, int v){ return v < u ? u = v, true : false; } inline bool maximizell(long long &u, long long v){ return v > u ? u = v, true : false; } inline bool minimizell(long long &u, long long v){ return v < u ? u = v, true : false; } const int mod = 1e9 + 7; inline int fastPow(int a, int n){ if(n == 0) return 1; int t = fastPow(a, n >> 1); t = 1ll * t * t % mod; if(n & 1) t = 1ll * t * a % mod; return t; } inline void add(int &u, int v){ u += v; if(u >= mod) u -= mod; } inline void sub(int &u, int v){ u -= v; if(u < 0) u += mod; } const int maxN = 2e5 + 5; const int inf = 1e9; const long long infll = 1e18; //string ords; //int N; //int press(string p){ // int answer = 0; // for(int t = 0; t < p.size(); ++t){ // int j = t, i = 0; // while(j < p.size() && i < N && ords[i] == p[j]){ // ++i; // ++j; // } // maximize(answer, j - t); // } // return answer; //} char c[] = {'A', 'B', 'X', 'Y'}; string t[] = {"A", "B", "X", "Y"}; string guess_sequence(int n){ string s = ""; if(press("AB")){ if(press("A")) s = "A"; else s = "B"; }else if(press("X")) s = "X"; else s = "Y"; vector<char> v; FOR(i, 0, 3)if(c[i] != s[0])v.emplace_back(c[i]); if(n == 1) return s; FOR(i, 1, n - 2){ string p = s + v[0] + s + v[1] + v[1] + s + v[1] + v[0] + s + v[1] + v[2]; int x = press(p); if(x == i + 1) s += v[0]; else if(x == i + 2) s += v[1]; else s += v[2]; } if(press(s + v[0]) == n) s += v[0]; else if(press(s + v[1]) == n) s += v[1]; else s += v[2]; return s; } //void process(){ // cin >> ords; // N = ords.size(); // string answer = guess_sequence(N); // assert(ords == answer); // cerr << ords << '\n' << answer; //} //#define LOVE "combo" //int main(){ // if(fopen(LOVE".inp", "r")){ // freopen(LOVE".inp", "r", stdin); // freopen(LOVE".out", "w", stdout); // } // ios_base::sync_with_stdio(false); // cin.tie(0); // cout.tie(0); // // int t = 1; //// cin >> t; // while(t--) // process(); //// cerr << '\n' << "Time elapsed: " << (1.0 * clock() / CLOCKS_PER_SEC) << " s\n" ; // return 0; //}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...