#include "secret.h"
#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;
int b[1005];
int t[1005][1005];
int cnt = 0;
int N;
void build(int l = 0, int r = N - 1){
if(l > r)return;
if(l == r){
t[l][r] = b[l];
return;
}
int mid = (l + r) >> 1;
t[mid][mid] = b[mid];
for(int i = mid - 1; i >= l; i--){
t[i][mid] = Secret(b[i], t[i + 1][mid]);
}
for(int i = mid + 1; i <= r; i++){
t[mid][i] = Secret(b[i], t[i - 1][mid]);
}
build(l, mid);
build(mid + 1, r);
}
int get(int al, int ar, int l = 0, int r = N - 1){
if(al > r || ar < l)return 0;
int mid = (l + r) >> 1;
if(l == r)
return b[l];
if(l >= al && ar <= r)
return Secret(t[l][mid], t[mid + 1][r]);
else{
return get(al, ar, l, mid) + get(al, ar, mid + 1, r);
}
}
int Query(int l, int r){
return get(l, r);
}
void Init(int n, int a[])
{
N = n;
for(int i=0;i<n;i++)b[i]=a[i];
build();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
103 ms |
6740 KB |
Wrong Answer: Query(222, 254) - expected : 34031541, actual : 1959315398. |
2 |
Incorrect |
101 ms |
6832 KB |
Wrong Answer: Query(60, 375) - expected : 669221184, actual : 1066186975. |
3 |
Incorrect |
112 ms |
6824 KB |
Wrong Answer: Query(211, 401) - expected : 674373968, actual : 667493811. |
4 |
Incorrect |
376 ms |
8372 KB |
Wrong Answer: Query(90, 497) - expected : 397934825, actual : -1461070706. |
5 |
Incorrect |
381 ms |
8316 KB |
Wrong Answer: Query(587, 915) - expected : 752404486, actual : 2007752820. |
6 |
Incorrect |
374 ms |
8284 KB |
Wrong Answer: Query(915, 915) - expected : 282904741, actual : 153487734. |
7 |
Incorrect |
377 ms |
8372 KB |
Wrong Answer: Query(84, 976) - expected : 742463504, actual : 293487556. |
8 |
Incorrect |
373 ms |
8272 KB |
Wrong Answer: Query(58, 987) - expected : 20022464, actual : -237746. |
9 |
Incorrect |
380 ms |
8324 KB |
Wrong Answer: Query(33, 967) - expected : 676869696, actual : 20638198. |
10 |
Incorrect |
386 ms |
8364 KB |
Wrong Answer: Query(116, 961) - expected : 68487362, actual : 993169031. |