Submission #736824

#TimeUsernameProblemLanguageResultExecution timeMemory
736824penguin133Secret (JOI14_secret)C++17
30 / 100
514 ms4472 KiB
#include <bits/stdc++.h> using namespace std; //#define int long long #include "secret.h" #define pi pair<int, int> #define pii pair<int, pi> #define fi first #define se second #ifdef _WIN32 #define getchar_unlocked _getchar_nolock #endif mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); int B[10005]; struct node{ int s, e, m, val; node *l, *r; node(int _s, int _e){ s = _s, e = _e, m = (s + e) >> 1; if(s != e){ l = new node(s, m); r = new node(m+1, e); val = Secret(l->val, r->val); } else val = B[s]; } int qry(int a, int b, int c = -2e9){ if(s == a && b == e){ if(c == -2e9)return val; else return Secret(c, val); } if(b <= m)return l->qry(a, b, c); else if(a > m)return r->qry(a, b, c); else{ int x = l->qry(a, m, c); return r->qry(m+1, b, x); } } }*root; void Init(int N, int A[]) { for(int i=0;i<N;i++)B[i] = A[i]; root = new node(0, N - 1); } int Query(int L, int R) { return root->qry(L, R); }
#Verdict Execution timeMemoryGrader output
Fetching results...