#include "secret.h"
#include "bits/stdc++.h"
using namespace std;
const int MAXN=1005;
int arr[MAXN],simpan[MAXN][MAXN],n;
void build(int L,int R){
if(L==R){
simpan[L][R]=arr[L];
return;
}
int mid=(L+R)/2;
int now=arr[mid];
for(int i=mid-1;i>=L;i--){
simpan[i][mid]=Secret(now,arr[i]);
now=simpan[i][mid];
}
now=arr[mid+1];
for(int i=mid+2;i<=R;i++){
simpan[mid+1][i]=Secret(now,arr[i]);
now=simpan[mid+1][i];
}
build(L,mid);
build(mid+1,R);
}
void Init(int N, int A[]) {
for(int i=1;i<=N;i++)arr[i]=A[i-1];
build(1,N);
n=N;
}
int tanya(int x,int y,int L,int R){
if(L==R){
return simpan[L][R];
}
int mid=(L+R)/2;
if(y<=mid){ // masuk kiri semua
return tanya(x,y,L,mid);
}
if(x>=mid+1){
return tanya(x,y,mid+1,R);
}
return Secret(simpan[x][mid],simpan[mid+1][y]);
}
int Query(int L,int R){
L++;R++;
return tanya(L,R,1,n);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
162 ms |
4600 KB |
Wrong Answer: Query(113, 206) - expected : 536899947, actual : 538256673. |
2 |
Incorrect |
163 ms |
4472 KB |
Wrong Answer: Query(60, 375) - expected : 669221184, actual : 311474560. |
3 |
Incorrect |
162 ms |
4600 KB |
Wrong Answer: Query(211, 401) - expected : 674373968, actual : 353554500. |
4 |
Incorrect |
592 ms |
8424 KB |
Wrong Answer: Query(90, 497) - expected : 397934825, actual : 343081568. |
5 |
Incorrect |
590 ms |
8440 KB |
Wrong Answer: Query(587, 915) - expected : 752404486, actual : 957013316. |
6 |
Incorrect |
603 ms |
8312 KB |
Wrong Answer: Query(747, 749) - expected : 244228265, actual : 935077363. |
7 |
Incorrect |
645 ms |
8348 KB |
Wrong Answer: Query(84, 976) - expected : 742463504, actual : 675449873. |
8 |
Incorrect |
617 ms |
8532 KB |
Wrong Answer: Query(58, 987) - expected : 20022464, actual : 273091792. |
9 |
Incorrect |
599 ms |
8324 KB |
Wrong Answer: Query(33, 967) - expected : 676869696, actual : 827853577. |
10 |
Incorrect |
599 ms |
8548 KB |
Wrong Answer: Query(116, 961) - expected : 68487362, actual : 337854787. |