#include "secret.h"
#include "bits/stdc++.h"
#define ll long long
using namespace std;
int n;
int v[1005];
int pref[4020][1005],suff[4020][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(v[p], pref[x][p+1]);
}
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<<1);
build(m+1, rx, x<<1|1);
}
void Init(int f , int a[])
{
n = f;
for(ll i=0;i<n;i++) v[i] = a[i];
build(0,0,n-1);
}
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<<1);
if(m < l) return get(l, r, m+1, rx, x<<1|1);
return ask(pref[x][l], suff[x][r]);
}
int Query(int l, int r)
{
return get(l,r , 0,n-1,1);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
114 ms |
2372 KB |
Wrong Answer: Query(222, 254) - expected : 34031541, actual : 536870912. |
2 |
Incorrect |
121 ms |
2296 KB |
Wrong Answer: Query(60, 375) - expected : 669221184, actual : 0. |
3 |
Incorrect |
115 ms |
2328 KB |
Wrong Answer: Query(211, 401) - expected : 674373968, actual : 536870912. |
4 |
Incorrect |
424 ms |
4228 KB |
Wrong Answer: Query(90, 497) - expected : 397934825, actual : 536870912. |
5 |
Incorrect |
428 ms |
4168 KB |
Wrong Answer: Query(587, 915) - expected : 752404486, actual : 536870912. |
6 |
Incorrect |
418 ms |
4224 KB |
Wrong Answer: Query(738, 741) - expected : 983692994, actual : 536870912. |
7 |
Incorrect |
427 ms |
4248 KB |
Wrong Answer: Query(84, 976) - expected : 742463504, actual : 0. |
8 |
Incorrect |
443 ms |
4168 KB |
Wrong Answer: Query(58, 987) - expected : 20022464, actual : 536870912. |
9 |
Incorrect |
428 ms |
4212 KB |
Wrong Answer: Query(33, 967) - expected : 676869696, actual : 0. |
10 |
Incorrect |
422 ms |
4264 KB |
Wrong Answer: Query(116, 961) - expected : 68487362, actual : 0. |