# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
736824 | penguin133 | Secret (JOI14_secret) | C++17 | 514 ms | 4472 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |