#include<bits/stdc++.h>
#include "secret.h"
using namespace std;
#define ii pair <int, int>
#define app push_back
#define all(a) a.begin(), a.end()
#define bp __builtin_popcount
#define ll long long
#define mp make_pair
#define f first
#define s second
const int N = 1001;
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 |
161 ms |
4352 KB |
Wrong Answer: Query(222, 254) - expected : 34031541, actual : 805576266. |
2 |
Incorrect |
160 ms |
4344 KB |
Wrong Answer: Query(60, 375) - expected : 669221184, actual : 571476064. |
3 |
Incorrect |
163 ms |
4508 KB |
Wrong Answer: Query(211, 401) - expected : 674373968, actual : 136730926. |
4 |
Incorrect |
590 ms |
8208 KB |
Wrong Answer: Query(90, 497) - expected : 397934825, actual : 870547617. |
5 |
Incorrect |
585 ms |
8164 KB |
Wrong Answer: Query(587, 915) - expected : 752404486, actual : 976357712. |
6 |
Incorrect |
589 ms |
8356 KB |
Wrong Answer: Query(738, 741) - expected : 983692994, actual : 942318537. |
7 |
Incorrect |
593 ms |
8236 KB |
Wrong Answer: Query(84, 976) - expected : 742463504, actual : 781793354. |
8 |
Incorrect |
592 ms |
8328 KB |
Wrong Answer: Query(58, 987) - expected : 20022464, actual : 499418120. |
9 |
Incorrect |
592 ms |
8344 KB |
Wrong Answer: Query(33, 967) - expected : 676869696, actual : 277351906. |
10 |
Incorrect |
595 ms |
8184 KB |
Wrong Answer: Query(116, 961) - expected : 68487362, actual : 274498057. |