Submission #1068949

#TimeUsernameProblemLanguageResultExecution timeMemory
1068949LuvidiSecret (JOI14_secret)C++17
30 / 100
355 ms4432 KiB
#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 timeMemoryGrader output
Fetching results...