#include "secret.h"
using namespace std;
const int nmax = 1000 + 5;
using namespace std;
int n, a[nmax];
int tree[nmax << 2];
void build(int id, int l, int r){
if(l == r){
tree[id] = a[l];
return;
}
int mid = (r + l)/2;
build(id *2, l, mid);
build(id *2 + 1, mid + 1, r);
tree[id] = Secret(tree[id *2 ], tree[id * 2 + 1]);
}
int get(int id, int l, int r, int u, int v){
if(l >= u && r <= v) return tree[id];
int mid = (r + l) /2;
if(mid< u) return get(id * 2 + 1, mid + 1, r, u, v);
if(mid + 1 > v) return get(id * 2, l, mid, u, v);
return Secret(get(id* 2, l, mid, u, v), get(id * 2 + 1, mid + 1, r, u, v));
}
void Init(int N, int A[]){
n = N;
for(int i = 0; i < n; ++i) a[i] = A[i];
build(1, 0, n - 1);
}
int Query(int l, int r){
return get(1, 0, n - 1, l, r);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
93 ms |
3628 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 |
92 ms |
3668 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 |
94 ms |
3664 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 |
295 ms |
4176 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 |
302 ms |
4176 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 |
259 ms |
4176 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 |
298 ms |
4360 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 |
292 ms |
4436 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 |
305 ms |
4188 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 |
296 ms |
4180 KB |
Output is partially correct - number of calls to Secret by Init = 999, maximum number of calls to Secret by Query = 16 |