# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1032013 |
2024-07-23T10:00:43 Z |
juicy |
Secret (JOI14_secret) |
C++17 |
|
299 ms |
8532 KB |
#include <bits/stdc++.h>
#include "secret.h"
using namespace std;
#ifdef LOCAL
#include "debug.h"
#else
#define debug(...) 42
#endif
int n;
int a[1000], F[1000][1000];
bool vs[1000];
void dc(int l = 0, int r = n - 1) {
if (l == r) {
return;
}
int md = (l + r) / 2;
dc(l, md);
dc(md + 1, r);
F[md][md] = a[md];
for (int i = md - 1; i >= l; --i) {
if (F[i][md] == -1) {
F[i][md] = Secret(a[i], F[i + 1][md]);
}
}
F[md + 1][md + 1] = a[md + 1];
for (int i = md + 2; i <= r; ++i) {
if (F[md + 1][i] == -1) {
F[md + 1][i] = Secret(F[md + 1][i - 1], a[i]);
}
}
}
int Query(int L, int R) {
for (int K = L; K < R; ++K) {
if (F[L][K] != -1 && F[K + 1][R] != -1) {
return Secret(F[L][K], F[K + 1][R]);
}
}
return a[L];
}
void Init(int _n, int *A) {
n = _n;
for (int i = 0; i < n; ++i) {
a[i] = A[i];
}
memset(F, -1, sizeof(F));
for (int i = 0; i < n; ++i) {
F[i][i] = a[i];
}
dc();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
85 ms |
8280 KB |
Output is correct - number of calls to Secret by Init = 3084, maximum number of calls to Secret by Query = 1 |
2 |
Correct |
90 ms |
8292 KB |
Output is correct - number of calls to Secret by Init = 3092, maximum number of calls to Secret by Query = 1 |
3 |
Correct |
79 ms |
8272 KB |
Output is correct - number of calls to Secret by Init = 3101, maximum number of calls to Secret by Query = 1 |
4 |
Correct |
274 ms |
8276 KB |
Output is correct - number of calls to Secret by Init = 6989, maximum number of calls to Secret by Query = 1 |
5 |
Correct |
272 ms |
8280 KB |
Output is correct - number of calls to Secret by Init = 6997, maximum number of calls to Secret by Query = 1 |
6 |
Correct |
275 ms |
8240 KB |
Output is correct - number of calls to Secret by Init = 6997, maximum number of calls to Secret by Query = 1 |
7 |
Correct |
263 ms |
8280 KB |
Output is correct - number of calls to Secret by Init = 6997, maximum number of calls to Secret by Query = 1 |
8 |
Correct |
283 ms |
8280 KB |
Output is correct - number of calls to Secret by Init = 6997, maximum number of calls to Secret by Query = 1 |
9 |
Correct |
299 ms |
8208 KB |
Output is correct - number of calls to Secret by Init = 6997, maximum number of calls to Secret by Query = 1 |
10 |
Correct |
295 ms |
8532 KB |
Output is correct - number of calls to Secret by Init = 6997, maximum number of calls to Secret by Query = 1 |