#include <bits/stdc++.h>
#include "secret.h"
using namespace std;
long long a[10000];
int tree[400000];int n;
void build(int v, int tl, int tr) {
if (tl == tr) {
tree[v] = a[tl];
} else {
int tm = (tl + tr) / 2;
build( v*2, tl, tm);
build( v*2+1, tm+1, tr);
tree[v] = Secret(tree[v*2],tree[v*2+1]);
}
}
void Init(int N, int A[]){
n=N;
for(long long i=0;i<N;i++){
a[i]=A[i];
}
build(0,0,N-1);
}
int sum(int v, int tl, int tr, int l, int r) {
if (l > r)
return -1 ;
if (l == tl && r == tr) {
return tree[v];
}
int tm = (tl + tr) / 2;
return Secret(sum(v*2, tl, tm, l, min(r, tm))
,sum(v*2+1, tm+1, tr, max(l, tm+1), r));
}
int Query(int L , int R){
return sum(0,0,n-1,L,R);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
110 ms |
2328 KB |
Wrong Answer [1] |
2 |
Incorrect |
110 ms |
2296 KB |
Wrong Answer [1] |
3 |
Incorrect |
120 ms |
2276 KB |
Wrong Answer [1] |
4 |
Incorrect |
429 ms |
4228 KB |
Wrong Answer [1] |
5 |
Incorrect |
414 ms |
4288 KB |
Wrong Answer [1] |
6 |
Incorrect |
434 ms |
4328 KB |
Wrong Answer [1] |
7 |
Incorrect |
415 ms |
4184 KB |
Wrong Answer [1] |
8 |
Incorrect |
426 ms |
4240 KB |
Wrong Answer [1] |
9 |
Incorrect |
428 ms |
4380 KB |
Wrong Answer [1] |
10 |
Incorrect |
410 ms |
4360 KB |
Wrong Answer [1] |