#include "secret.h"
int N;
int A[1000],Tree[1<<11];
int init_tree(int s,int e,int n){
if (s==e)
return Tree[n]=A[s];
int m=(s+e)>>1;
return Tree[n]=Secret(init_tree(s,m,n<<1),init_tree(m+1,e,n<<1|1));
}
void Init(int n,int a[]){
N=n;
for (int i=0; i<N; i++)
A[i]=a[i];
init_tree(0,N-1,1);
}
int query_tree(int s,int e,int l,int r,int n){
int m=(s+e)>>1;
if (l<=s&&e<=r)
return Tree[n];
if (l>m)
return query_tree(m+1,e,l,r,n<<1|1);
if (r<=m)
return query_tree(s,m,l,r,n<<1);
return Secret(query_tree(s,m,l,r,n<<1),query_tree(m+1,e,l,r,n<<1|1));
}
int Query(int l,int r){
return query_tree(0,N-1,l,r,1);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
158 ms |
2372 KB |
Output is partially correct - number of calls to Secret by Init = 510, maximum number of calls to Secret by Query = 13 |
2 |
Partially correct |
159 ms |
2532 KB |
Output is partially correct - number of calls to Secret by Init = 511, maximum number of calls to Secret by Query = 14 |
3 |
Partially correct |
159 ms |
2512 KB |
Output is partially correct - number of calls to Secret by Init = 512, maximum number of calls to Secret by Query = 15 |
4 |
Partially correct |
466 ms |
4292 KB |
Output is partially correct - number of calls to Secret by Init = 998, maximum number of calls to Secret by Query = 15 |
5 |
Partially correct |
468 ms |
4400 KB |
Output is partially correct - number of calls to Secret by Init = 999, maximum number of calls to Secret by Query = 15 |
6 |
Partially correct |
416 ms |
4292 KB |
Output is partially correct - number of calls to Secret by Init = 999, maximum number of calls to Secret by Query = 4 |
7 |
Partially correct |
486 ms |
4292 KB |
Output is partially correct - number of calls to Secret by Init = 999, maximum number of calls to Secret by Query = 16 |
8 |
Partially correct |
487 ms |
4344 KB |
Output is partially correct - number of calls to Secret by Init = 999, maximum number of calls to Secret by Query = 16 |
9 |
Partially correct |
480 ms |
4280 KB |
Output is partially correct - number of calls to Secret by Init = 999, maximum number of calls to Secret by Query = 16 |
10 |
Partially correct |
490 ms |
4292 KB |
Output is partially correct - number of calls to Secret by Init = 999, maximum number of calls to Secret by Query = 16 |