#include <bits/stdc++.h>
#include "secret.h"
using namespace std;
long long a[10000];
long long tree[400000];int n;
int mer(int a,int b){
if(a==-1){return b;}
if(b==-1){return a;}
return Secret(a,b);
}
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] = mer(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 mer(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 |
112 ms |
2316 KB |
Wrong Answer: Query(222, 254) - expected : 34031541, actual : 315980659. |
2 |
Incorrect |
124 ms |
2384 KB |
Wrong Answer: Query(60, 375) - expected : 669221184, actual : 922431905. |
3 |
Incorrect |
115 ms |
2444 KB |
Wrong Answer: Query(211, 401) - expected : 674373968, actual : 87513210. |
4 |
Incorrect |
422 ms |
4228 KB |
Wrong Answer: Query(90, 497) - expected : 397934825, actual : 546325106. |
5 |
Incorrect |
449 ms |
4228 KB |
Wrong Answer: Query(263, 292) - expected : 653448456, actual : 15892812. |
6 |
Incorrect |
408 ms |
4232 KB |
Wrong Answer: Query(200, 208) - expected : 277813445, actual : 549079216. |
7 |
Incorrect |
433 ms |
4192 KB |
Wrong Answer: Query(84, 976) - expected : 742463504, actual : 215581720. |
8 |
Incorrect |
412 ms |
4296 KB |
Wrong Answer: Query(58, 987) - expected : 20022464, actual : 336853080. |
9 |
Incorrect |
448 ms |
4312 KB |
Wrong Answer: Query(33, 967) - expected : 676869696, actual : 818818691. |
10 |
Incorrect |
420 ms |
4276 KB |
Wrong Answer: Query(116, 961) - expected : 68487362, actual : 880675712. |