#include "secret.h"
#include <bits/stdc++.h>
#ifndef EVAL
#include "grader.cpp"
#endif
using namespace std;
typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define sz(v) int((v).size())
#define do_not_disturb ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl
const int MAXN = 1e3+3;
int LL[MAXN][MAXN], RR[MAXN][MAXN], V[MAXN];
int n;
void dnc(int l, int r) {
if (l > r) return;
int mid = (l+r) >> 1;
LL[mid][mid] = V[mid];
if (l == r) {
return;
}
RR[mid][mid+1] = V[mid+1];
for (int i = mid-1; i >= l; i--) {
LL[mid][i] = Secret(LL[mid][i+1], V[i]);
}
for (int i = mid+2; i <= r; i++) {
RR[mid][i] = Secret(RR[mid][i-1], V[i]);
}
dnc(l, mid);
dnc(mid+1, r);
}
void Init(int N, int A[]) {
n = N;
for (int i = 0; i < n; i++) {
V[i] = A[i];
}
dnc(0, n-1);
}
int get(int l, int r, int ql, int qr) {
if (l == r) return V[l];
if (l > r) return 0;
int mid = (l+r) >> 1;
if (l <= ql && qr <= r && ql <= mid && mid < qr) {
return Secret(LL[mid][ql], RR[mid][qr]);
}
if (ql > mid) return get(mid+1, r, ql, qr);
else return get(l, mid, ql, qr);
}
int Query(int L, int R) {
return get(0, n-1, L, R);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
115 ms |
6364 KB |
Wrong Answer: Query(222, 254) - expected : 34031541, actual : 268854015. |
2 |
Incorrect |
118 ms |
6480 KB |
Wrong Answer: Query(60, 375) - expected : 669221184, actual : 311474560. |
3 |
Incorrect |
115 ms |
6440 KB |
Wrong Answer: Query(211, 401) - expected : 674373968, actual : 353554500. |
4 |
Incorrect |
427 ms |
12228 KB |
Wrong Answer: Query(90, 497) - expected : 397934825, actual : 343081568. |
5 |
Incorrect |
432 ms |
12128 KB |
Wrong Answer: Query(587, 915) - expected : 752404486, actual : 957013316. |
6 |
Incorrect |
425 ms |
12156 KB |
Wrong Answer: Query(200, 208) - expected : 277813445, actual : 154975445. |
7 |
Incorrect |
440 ms |
12156 KB |
Wrong Answer: Query(84, 976) - expected : 742463504, actual : 675449873. |
8 |
Incorrect |
436 ms |
12156 KB |
Wrong Answer: Query(58, 987) - expected : 20022464, actual : 273091792. |
9 |
Incorrect |
452 ms |
12108 KB |
Wrong Answer: Query(33, 967) - expected : 676869696, actual : 827853577. |
10 |
Incorrect |
436 ms |
12236 KB |
Wrong Answer: Query(116, 961) - expected : 68487362, actual : 337854787. |