# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
70245 | Pajaraja | Secret (JOI14_secret) | C++17 | 637 ms | 8648 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"
int v[1007][1007],a[1007],n;void t(int l,int r){int s=(l+r)/2;for(int i=s-1;i>=l;i--)v[i][s]=Secret(a[i],v[i+1][s]);for(int i=s+2;i<=r;i++)v[s+1][i]=Secret(v[s+1][i-1],a[i]);if(l==r)return;t(l,s);t(s+1,r);}void Init(int N,int A[]){n=N;for(int i=0;i<n;i++)v[i][i]=a[i]=A[i];t(0,n-1);}int b(int l,int r,int lt,int rt){if(l==r) return a[l];int s=(l+r)/2;if(lt<=s&&rt>s)return Secret(v[lt][s],v[s+1][rt]);if(rt<=s)return b(l,s,lt,rt);return b(s+1,r,lt,rt);}int Query(int L, int R){return b(0,n-1,L,R);}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |