Submission #70278

# Submission time Handle Problem Language Result Execution time Memory
70278 2018-08-22T14:37:22 Z Pajaraja Secret (JOI14_secret) C++17
100 / 100
714 ms 8596 KB
#include "secret.h"
#define g return
#define q int
q i,v[1007][1007],*a,n,s;void t(q l,q r){s=(l+r)/2;for(i=s-1;i>=l;i--)v[i][s]=Secret(a[i],v[i+1][s]);for(i=s+2;i<=r;i++)v[s+1][i]=Secret(v[s+1][i-1],a[i]);if(l==r)g;t(l,s);t(s+1,r);}void Init(q N,q*A){for(i=0;i<N;i++)v[i][i]=A[i];a=A;t(0,n=--N);}q b(q l,q r,q o,q u){if(l==r)g a[l];s=(l+r)/2;if(o<=s&&u>s)g Secret(v[o][s],v[s+1][u]);if(u<=s)g b(l,s,o,u);g b(s+1,r,o,u);}q Query(q L,q R){g b(0,n,L,R);}
# Verdict Execution time Memory Grader output
1 Correct 183 ms 4476 KB Output is correct - number of calls to Secret by Init = 3578, maximum number of calls to Secret by Query = 1
2 Correct 185 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 187 ms 4600 KB Output is correct - number of calls to Secret by Init = 3595, maximum number of calls to Secret by Query = 1
4 Correct 627 ms 8348 KB Output is correct - number of calls to Secret by Init = 7969, maximum number of calls to Secret by Query = 1
5 Correct 611 ms 8400 KB Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1
6 Correct 653 ms 8536 KB Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1
7 Correct 677 ms 8596 KB Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1
8 Correct 684 ms 8596 KB Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1
9 Correct 714 ms 8596 KB Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1
10 Correct 654 ms 8596 KB Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1