#include <bits/stdc++.h>
#include "secret.h"
using namespace std;
int Q,l,r;
int drvo[2000005];
int n,a[2000005];
void update(int i,int j,int poz,int val,int node){
if(i == j){
drvo[node] = val;
return;
}
int mid = i+(j-i)/2;
if(poz <= mid){
update(i,mid,poz,val,2*node+1);
}
else{
update(mid+1,j,poz,val,2*node+2);
}
drvo[node] = Secret(drvo[2*node+1],drvo[2*node+2]);
}
int get(int i,int j,int l,int r,int node){
if(j < l || i > r){
return 0;
}
if(l <= i && r >= j){
return drvo[node];
}
int mid = i+(j-i)/2;
return Secret(get(i,mid,l,r,2*node+2),get(mid+1,j,l,r,2*node+2));
}
int Query(int L,int R){
return get(0,n-1,L,R,0);
}
void Init(int N,int A[]){
n = N;
for(int i = 0; i < N; i++){
update(0,n-1,i,A[i],0);
a[i] = A[i];
}
cin >> Q;
while(Q--){
cin >> l >> r;
cout << Query(l,r) << endl;
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
166 ms |
2552 KB |
Wrong Answer: Query(222, 254) - expected : 34031541, actual : 574622625. |
2 |
Incorrect |
164 ms |
2672 KB |
Wrong Answer: Query(60, 375) - expected : 669221184, actual : 598878345. |
3 |
Incorrect |
165 ms |
2772 KB |
Wrong Answer: Query(211, 401) - expected : 674373968, actual : 738560370. |
4 |
Incorrect |
601 ms |
4892 KB |
Wrong Answer: Query(90, 497) - expected : 397934825, actual : 330940997. |
5 |
Incorrect |
592 ms |
4892 KB |
Wrong Answer: Query(587, 915) - expected : 752404486, actual : 723650576. |
6 |
Incorrect |
612 ms |
5160 KB |
Wrong Answer: Query(915, 915) - expected : 282904741, actual : 536870912. |
7 |
Incorrect |
601 ms |
5204 KB |
Wrong Answer: Query(84, 976) - expected : 742463504, actual : 157811817. |
8 |
Incorrect |
638 ms |
5304 KB |
Wrong Answer: Query(58, 987) - expected : 20022464, actual : 154376576. |
9 |
Incorrect |
629 ms |
5364 KB |
Wrong Answer: Query(33, 967) - expected : 676869696, actual : 948572642. |
10 |
Incorrect |
639 ms |
5648 KB |
Wrong Answer: Query(116, 961) - expected : 68487362, actual : 272376078. |