# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
574023 |
2022-06-07T15:15:19 Z |
Vanilla |
Secret (JOI14_secret) |
C++17 |
|
551 ms |
8208 KB |
#include <bits/stdc++.h>
#include "secret.h"
using namespace std;
const int maxn = 1001;
int pref [maxn][maxn];
int sg [maxn][maxn];
void build (int l, int r) {
if (l >= r) return;
int mid = (l + r) / 2;
for (int i = mid + 2; i < r; i++){
pref[mid + 1][i] = Secret(pref[i][i], pref[mid + 1][i-1]);
}
for (int i = mid - 1; i >= l; i--){
pref[i][mid] = Secret(pref[i][i], pref[i + 1][mid]);
}
build (l, mid);
build (mid + 1, r);
}
void Init(int N, int A[]) {
for (int i = 0; i < N; i++){
for (int j = 0; j < N; j++) {
pref[i][j] = -1;
}
}
for (int i = 0; i < N; i++){
pref[i][i] = A[i];
}
build(0, N);
}
int Query(int L, int R) {
if (pref[L][R] != -1) return pref[L][R];
int mid = sg[L][R];
return Secret(pref[L][mid], pref[mid + 1][R]);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
135 ms |
4288 KB |
Wrong Answer [1] |
2 |
Incorrect |
116 ms |
4356 KB |
Wrong Answer [1] |
3 |
Incorrect |
116 ms |
4412 KB |
Wrong Answer [1] |
4 |
Incorrect |
444 ms |
8140 KB |
Wrong Answer [1] |
5 |
Incorrect |
435 ms |
8208 KB |
Wrong Answer [1] |
6 |
Incorrect |
464 ms |
8204 KB |
Wrong Answer [1] |
7 |
Incorrect |
468 ms |
8140 KB |
Wrong Answer [1] |
8 |
Incorrect |
478 ms |
8120 KB |
Wrong Answer [1] |
9 |
Incorrect |
470 ms |
8084 KB |
Wrong Answer [1] |
10 |
Incorrect |
551 ms |
8172 KB |
Wrong Answer [1] |