# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
881966 |
2023-12-02T10:51:17 Z |
Alan |
Secret (JOI14_secret) |
C++17 |
|
381 ms |
8616 KB |
#include <bits/stdc++.h>
using namespace std;
int Secret(int X, int Y);
int ans[1005][1005], N;
void calc (int l, int r) {
if (r-l <= 2) return;
int mid = (l+r)/2;
for (int i = mid-1; i >= l; i--) ans[i][mid] = Secret(i, mid);
for (int i = mid+2; i <= r; i++) ans[mid+1][i] = Secret(mid+1, i);
calc(l, mid);
calc(mid+1, r);
}
void Init (int n, int A[]) {
N = n;
for (int i = 0; i < n; i++) ans[i][i] = A[i];
calc(1, n);
}
int solve (int l, int r, int ql, int qr) {
int mid = (l+r)/2;
if (qr <= mid) return solve(l, mid, ql, qr);
if (mid+1 <= l) return solve(mid+1, r, ql, qr);
return Secret(ans[ql][mid], ans[mid+1][qr]);
}
int Query (int L, int R) {
return solve(1, N, L, R);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
100 ms |
6828 KB |
Wrong Answer: Query(222, 254) - expected : 34031541, actual : 4486641. |
2 |
Incorrect |
101 ms |
6828 KB |
Wrong Answer: Query(60, 375) - expected : 669221184, actual : 845222152. |
3 |
Incorrect |
100 ms |
6736 KB |
Wrong Answer: Query(211, 401) - expected : 674373968, actual : 143984672. |
4 |
Incorrect |
375 ms |
8368 KB |
Wrong Answer: Query(90, 497) - expected : 397934825, actual : 92979738. |
5 |
Incorrect |
369 ms |
8372 KB |
Wrong Answer: Query(587, 915) - expected : 752404486, actual : 604127236. |
6 |
Incorrect |
381 ms |
8616 KB |
Wrong Answer: Query(915, 915) - expected : 282904741, actual : 805463384. |
7 |
Incorrect |
374 ms |
8280 KB |
Wrong Answer: Query(84, 976) - expected : 742463504, actual : 659564621. |
8 |
Incorrect |
378 ms |
8584 KB |
Wrong Answer: Query(58, 987) - expected : 20022464, actual : 547447763. |
9 |
Incorrect |
371 ms |
8272 KB |
Wrong Answer: Query(33, 967) - expected : 676869696, actual : 1318989. |
10 |
Incorrect |
379 ms |
8592 KB |
Wrong Answer: Query(116, 961) - expected : 68487362, actual : 607398405. |