#include "secret.h"
#include <bits/stdc++.h>
using namespace std;
const int mxn = 1002;
int a[mxn][mxn], n;
void fix(int l, int r) {
int mid = (l + r) >> 1;
if(r - l <= 1)
return;
for(int i = mid + 1; i <= r; i++)
a[mid][i] = Secret(a[mid][i - 1], a[i][i]);
for(int i = mid - 1; i >= l; i--)
a[i][mid] = Secret(a[i][i], a[i + 1][mid]);
fix(l, mid);
fix(mid + 1, r);
}
void Init(int N, int A[]) {
n = N;
for(int i = 0; i < n; i++)
for(int j = 0; j < n; j++)
a[i][j] = (i == j ? A[i] : -1);
fix(0, n - 1);
}
int answer(int l, int r, int ql, int qr) {
int mid = (l + r) >> 1;
if(ql > mid)
return answer(mid + 1, r, ql, qr);
else if(qr < mid)
return answer(l, mid, ql, qr);
return Secret(a[ql][mid], a[mid + 1][qr]);
}
int Query(int L, int R) {
return answer(0, n - 1, L, R);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
138 ms |
4436 KB |
Wrong Answer [1] |
2 |
Incorrect |
141 ms |
4368 KB |
Wrong Answer [1] |
3 |
Incorrect |
142 ms |
4404 KB |
Wrong Answer [1] |
4 |
Incorrect |
522 ms |
8428 KB |
Wrong Answer [1] |
5 |
Incorrect |
505 ms |
8300 KB |
Wrong Answer [1] |
6 |
Incorrect |
528 ms |
8296 KB |
Wrong Answer [1] |
7 |
Incorrect |
506 ms |
8240 KB |
Wrong Answer [1] |
8 |
Incorrect |
508 ms |
8172 KB |
Wrong Answer [1] |
9 |
Incorrect |
515 ms |
8172 KB |
Wrong Answer [1] |
10 |
Incorrect |
513 ms |
8300 KB |
Wrong Answer [1] |