Submission #70251

# Submission time Handle Problem Language Result Execution time Memory
70251 2018-08-22T14:12:57 Z Pajaraja Secret (JOI14_secret) C++17
100 / 100
690 ms 8556 KB
#include "secret.h"
#define g return
#define p Secret
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]=p(a[i],v[i+1][s]);for(int i=s+2;i<=r;i++)v[s+1][i]=p(v[s+1][i-1],a[i]);if(l==r)g;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 o,int u){if(l==r) g a[l];int s=(l+r)/2;if(o<=s&&u>s)g p(v[o][s],v[s+1][u]);if(u<=s)g b(l,s,o,u);g b(s+1,r,o,u);}int Query(int L, int R){g b(0,n-1,L,R);}
# Verdict Execution time Memory Grader output
1 Correct 195 ms 4344 KB Output is correct - number of calls to Secret by Init = 3578, maximum number of calls to Secret by Query = 1
2 Correct 188 ms 4476 KB Output is correct - number of calls to Secret by Init = 3586, maximum number of calls to Secret by Query = 1
3 Correct 174 ms 4476 KB Output is correct - number of calls to Secret by Init = 3595, maximum number of calls to Secret by Query = 1
4 Correct 617 ms 8504 KB Output is correct - number of calls to Secret by Init = 7969, maximum number of calls to Secret by Query = 1
5 Correct 654 ms 8556 KB Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1
6 Correct 672 ms 8556 KB Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1
7 Correct 671 ms 8556 KB Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1
8 Correct 690 ms 8556 KB Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1
9 Correct 645 ms 8556 KB Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1
10 Correct 650 ms 8556 KB Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1