#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 = 1; i <= n; ++i) mem[i][i] = a[i];
prec(1, n);
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(1, memn, l, r); }
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
160 ms |
4640 KB |
Wrong Answer: Query(222, 254) - expected : 34031541, actual : 538071723. |
2 |
Incorrect |
160 ms |
4424 KB |
Wrong Answer: Query(60, 375) - expected : 669221184, actual : 577800329. |
3 |
Incorrect |
166 ms |
4428 KB |
Wrong Answer: Query(211, 401) - expected : 674373968, actual : 739258474. |
4 |
Incorrect |
587 ms |
8260 KB |
Wrong Answer: Query(90, 497) - expected : 397934825, actual : 637583951. |
5 |
Incorrect |
588 ms |
8504 KB |
Wrong Answer: Query(587, 915) - expected : 752404486, actual : 370165842. |
6 |
Incorrect |
596 ms |
8628 KB |
Wrong Answer: Query(117, 121) - expected : 983571657, actual : 940787201. |
7 |
Incorrect |
591 ms |
8564 KB |
Wrong Answer: Query(84, 976) - expected : 742463504, actual : 798072834. |
8 |
Incorrect |
593 ms |
8476 KB |
Wrong Answer: Query(58, 987) - expected : 20022464, actual : 478291224. |
9 |
Incorrect |
610 ms |
8352 KB |
Wrong Answer: Query(33, 967) - expected : 676869696, actual : 676731340. |
10 |
Incorrect |
593 ms |
8372 KB |
Wrong Answer: Query(116, 961) - expected : 68487362, actual : 5629768. |