# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1068949 | Luvidi | Secret (JOI14_secret) | C++17 | 355 ms | 4432 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 "secret.h"
const int maxn=1000;
int *a,n,seg[4*maxn+31];
int build(int v,int l,int r){
if(l==r)return seg[v]=a[l];
int m=(l+r)/2;
return seg[v]=Secret(build(2*v+1,l,m),build(2*v+2,m+1,r));
}
int query(int v,int l,int r,int l2,int r2){
if(l>r2||r<l2)return -1;
if(l2<=l&&r<=r2)return seg[v];
int m=(l+r)/2;
int x=query(2*v+1,l,m,l2,r2),y=query(2*v+2,m+1,r,l2,r2);
if(x==-1)return y;
if(y==-1)return x;
return Secret(x,y);
}
void Init(int N, int A[]) {
n=N;
a=A;
build(0,0,n-1);
}
int Query(int l, int r) {
return query(0,0,n-1,l,r);
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |