# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1043773 |
2024-08-04T16:51:38 Z |
Tofu |
Secret (JOI14_secret) |
C++11 |
|
278 ms |
4436 KB |
#include "secret.h"
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1005;
int n;
int a[MAXN];
int ans[20][MAXN];
void F(int lv, int l, int r) {
if(l == r) {
ans[lv][l] = a[l];
return;
}
int m = (l + r) / 2;
ans[lv][m] = a[m];
for(int i = m-1; i >= l; i--) {
ans[lv][i] = Secret(a[i], ans[lv][i+1]);
}
ans[lv][m+1] = a[m+1];
for(int i = m+2; i <= r; i++) {
ans[lv][i] = Secret(ans[lv][i-1], a[i]);
}
F(lv+1, l, m);
F(lv+1, m+1, r);
}
int G(int lv, int l, int r, int ql, int qr) {
int m = (l+r)/2;
if(qr <= m) {
return G(lv+1, l, m, ql, qr);
}
if(m+1 <= ql) {
return G(lv+1, m+1, r, ql, qr);
}
return Secret(ans[lv][ql], ans[lv][qr]);
}
void Init(int N, int A[]) {
n = N;
for(int i = 1; i <= n; i++) a[i] = A[i-1];
F(1, 1, n);
}
int Query(int L, int R) {
if(L == R) return a[L];
return G(1, 1, n, L, R);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
68 ms |
2728 KB |
Wrong Answer: Query(222, 254) - expected : 34031541, actual : 22166791. |
2 |
Incorrect |
67 ms |
2652 KB |
Wrong Answer: Query(60, 375) - expected : 669221184, actual : 306225408. |
3 |
Incorrect |
66 ms |
2652 KB |
Wrong Answer: Query(211, 401) - expected : 674373968, actual : 629483540. |
4 |
Incorrect |
253 ms |
4432 KB |
Wrong Answer: Query(90, 497) - expected : 397934825, actual : 34079308. |
5 |
Incorrect |
278 ms |
4432 KB |
Wrong Answer: Query(587, 915) - expected : 752404486, actual : 542818560. |
6 |
Incorrect |
265 ms |
4432 KB |
Wrong Answer: Query(915, 915) - expected : 282904741, actual : 579799611. |
7 |
Incorrect |
260 ms |
4432 KB |
Wrong Answer: Query(84, 976) - expected : 742463504, actual : 772352096. |
8 |
Incorrect |
254 ms |
4436 KB |
Wrong Answer: Query(58, 987) - expected : 20022464, actual : 290455552. |
9 |
Incorrect |
256 ms |
4436 KB |
Wrong Answer: Query(33, 967) - expected : 676869696, actual : 164632041. |
10 |
Incorrect |
262 ms |
4436 KB |
Wrong Answer: Query(116, 961) - expected : 68487362, actual : 872638089. |