#include "secret.h"
#include <bits/stdc++.h>
using namespace std;
int num_of_elements = 0;
long long mas[1010];
long long segt[4010];
void init(int pos=1,int l=1, int r=num_of_elements){
if(l==r){
segt[pos]=mas[l];
return;
}
int mid=(l+r)/2;
init(pos*2,l,mid);
init(pos*2+1,mid+1, r);
segt[pos]=Secret(segt[pos*2],segt[pos*2+1]);
}
long long sum(int i, int j, int l=1, int r=num_of_elements, int pos=1){
if(j<l||r<i)return 0;
if(i<=l&&r<=j)return segt[pos];
int mid=(l+r)/2;
return sum(i,j,l,mid,pos*2)+sum(i,j,mid+1,r,pos*2+1);
}
void Init(int N, int A[]){
num_of_elements=N;
for(int i=0;i<N;i++){
mas[i]=A[i];
}
init();
}
int Query(int L, int R){
return sum(L,R);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
97 ms |
2648 KB |
Wrong Answer: Query(222, 254) - expected : 34031541, actual : 1395990149. |
2 |
Incorrect |
102 ms |
2896 KB |
Wrong Answer: Query(60, 375) - expected : 669221184, actual : 1051128059. |
3 |
Incorrect |
99 ms |
2640 KB |
Wrong Answer: Query(211, 401) - expected : 674373968, actual : -1941911076. |
4 |
Incorrect |
370 ms |
4724 KB |
Wrong Answer: Query(90, 497) - expected : 397934825, actual : -1931764879. |
5 |
Incorrect |
370 ms |
4432 KB |
Wrong Answer: Query(587, 915) - expected : 752404486, actual : -922515955. |
6 |
Incorrect |
389 ms |
4432 KB |
Wrong Answer: Query(738, 741) - expected : 983692994, actual : 905502165. |
7 |
Incorrect |
375 ms |
4304 KB |
Wrong Answer: Query(84, 976) - expected : 742463504, actual : 788690354. |
8 |
Incorrect |
374 ms |
4304 KB |
Wrong Answer: Query(58, 987) - expected : 20022464, actual : 521277386. |
9 |
Incorrect |
372 ms |
4432 KB |
Wrong Answer: Query(33, 967) - expected : 676869696, actual : 1119256918. |
10 |
Incorrect |
386 ms |
4272 KB |
Wrong Answer: Query(116, 961) - expected : 68487362, actual : 2080976420. |