#include "secret.h"
#include "bits/stdc++.h"
#define ll long long
using namespace std;
int n;
int v[1005];
int pref[4005][1005],suff[4005][1005];
int ask(int a, int b){
return Secret(a, b);
}
void build(ll lx,ll rx,int x)
{
if(lx == rx) return;
ll m = (lx + rx)/2;
pref[x][m] = v[m];
for(int p=m-1;p>=lx;p--){
pref[x][p] = ask( pref[x][p+1] , v[p]);
}
suff[x][m+1] = v[m+1];
for(int p=m+2;p<=rx;p++){
suff[x][p] = ask(suff[x][p-1], v[p]);
}
build(lx, m, x*2+1);
build(m+1, rx, x*2+2);
}
void Init(int f , int a[])
{
n = f;
for(ll i=0;i<n;i++) v[i] = a[i];
build(0,n-1,0);
}
int get(int l, int r, int lx, int rx, int x){
if(lx == rx) return v[lx];
int m = (lx + rx) >> 1;
if(r <= m) return get(l, r, lx, m, x*2+1);
if(m < l) return get(l, r, m+1, rx, x*2+2);
return ask(pref[x][l], suff[x][r]);
}
int Query(int l, int r)
{
return get(l,r , 0,n-1,0);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
118 ms |
6300 KB |
Wrong Answer: Query(222, 254) - expected : 34031541, actual : 268854015. |
2 |
Incorrect |
115 ms |
6400 KB |
Wrong Answer: Query(60, 375) - expected : 669221184, actual : 311474560. |
3 |
Incorrect |
113 ms |
6348 KB |
Wrong Answer: Query(211, 401) - expected : 674373968, actual : 353554500. |
4 |
Incorrect |
417 ms |
12112 KB |
Wrong Answer: Query(90, 497) - expected : 397934825, actual : 343081568. |
5 |
Incorrect |
426 ms |
12040 KB |
Wrong Answer: Query(587, 915) - expected : 752404486, actual : 957013316. |
6 |
Incorrect |
432 ms |
12100 KB |
Wrong Answer: Query(200, 208) - expected : 277813445, actual : 154975445. |
7 |
Incorrect |
422 ms |
12068 KB |
Wrong Answer: Query(84, 976) - expected : 742463504, actual : 675449873. |
8 |
Incorrect |
426 ms |
12124 KB |
Wrong Answer: Query(58, 987) - expected : 20022464, actual : 273091792. |
9 |
Incorrect |
421 ms |
12100 KB |
Wrong Answer: Query(33, 967) - expected : 676869696, actual : 827853577. |
10 |
Incorrect |
433 ms |
12084 KB |
Wrong Answer: Query(116, 961) - expected : 68487362, actual : 337854787. |