#include<bits/stdc++.h>
#include "secret.h"
using namespace std;
const int N = 1000;
int mem[N][N], memn;
void prec(int l, int r) {
if (l == r) return;
int m = (l + r) >> 1;
prec(l, m); prec(m + 1, r);
for (int i = m - 1; i >= l; --i) mem[i][m] = Secret(mem[i][i], mem[i + 1][m]);
for (int i = m + 2; i <= r; ++i) mem[m][i] = Secret(mem[m + 1][i - 1], mem[i][i]);
}
void Init(int n, int a[]) {
for (int i = 0; i < n; ++i) mem[i][i] = a[i];
prec(0, n - 1);
memn = n;
}
int get(int tl, int tr, int l, int r) {
if (tl == tr) return mem[tl][tl];
int tm = (tl + tr) >> 1;
if (r <= tm) return get(tl, tm, l, r);
if (tm < l) return get(tm + 1, tr, l, r);
return Secret(mem[l][tm], mem[tm + 1][r]);
}
int Query(int l, int r) { return get(0, memn - 1, l, r); }
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
160 ms |
4344 KB |
Wrong Answer: Query(222, 254) - expected : 34031541, actual : 805576266. |
2 |
Incorrect |
161 ms |
4600 KB |
Wrong Answer: Query(60, 375) - expected : 669221184, actual : 571476064. |
3 |
Incorrect |
162 ms |
4532 KB |
Wrong Answer: Query(211, 401) - expected : 674373968, actual : 136730926. |
4 |
Incorrect |
595 ms |
8312 KB |
Wrong Answer: Query(90, 497) - expected : 397934825, actual : 870547617. |
5 |
Incorrect |
587 ms |
8592 KB |
Wrong Answer: Query(587, 915) - expected : 752404486, actual : 976357712. |
6 |
Incorrect |
592 ms |
8248 KB |
Wrong Answer: Query(738, 741) - expected : 983692994, actual : 942318537. |
7 |
Incorrect |
595 ms |
8324 KB |
Wrong Answer: Query(84, 976) - expected : 742463504, actual : 781793354. |
8 |
Incorrect |
592 ms |
8448 KB |
Wrong Answer: Query(58, 987) - expected : 20022464, actual : 499418120. |
9 |
Incorrect |
589 ms |
8384 KB |
Wrong Answer: Query(33, 967) - expected : 676869696, actual : 277351906. |
10 |
Incorrect |
593 ms |
8384 KB |
Wrong Answer: Query(116, 961) - expected : 68487362, actual : 274498057. |