# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
989152 |
2024-05-27T15:46:22 Z |
aykhn |
Secret (JOI14_secret) |
C++17 |
|
453 ms |
4524 KB |
#include "secret.h"
#include <bits/stdc++.h>
using namespace std;
int n;
int val[15][1005];
int a[1005];
void build(int l, int r, int d)
{
if (l >= r) return;
int mid = (l + r) >> 1;
val[d][mid] = a[mid];
val[d][mid + 1] = a[mid + 1];
for (int i = mid - 1; i >= 0; i--) val[d][i] = Secret(a[i], val[d][i + 1]);
for (int i = mid + 2; i <= r; i++) val[d][i] = Secret(val[d][i - 1], a[i]);
build(l, mid - 1, d + 1);
build(mid + 2, r, d + 1);
}
void Init(int N, int A[])
{
n = N;
for (int i = 0; i < N; i++) a[i] = A[i];
build(0, N - 1, 0);
}
int get(int l, int r, int d, int lx, int rx)
{
if (!(l <= lx && r >= rx)) return -1;
int mid = (l + r) >> 1;
int x = get(l, mid - 1, d + 1, lx, rx);
if (x != -1) return x;
x = get(mid + 2, r, d + 1, lx, rx);
if (x != -1) return x;
if (lx > mid) return val[d][rx];
if (rx <= mid) return val[d][lx];
return Secret(val[d][lx], val[d][rx]);
}
int Query(int L, int R)
{
if (L == R) return a[L];
return get(0, n - 1, 0, L, R);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
113 ms |
2652 KB |
Wrong Answer: Query(222, 254) - expected : 34031541, actual : 857017776. |
2 |
Incorrect |
117 ms |
2648 KB |
Wrong Answer: Query(102, 157) - expected : 32612619, actual : 772946080. |
3 |
Incorrect |
115 ms |
2652 KB |
Wrong Answer: Query(334, 369) - expected : 363022362, actual : 942925910. |
4 |
Incorrect |
442 ms |
4356 KB |
Wrong Answer: Query(90, 497) - expected : 397934825, actual : 638075635. |
5 |
Incorrect |
447 ms |
4360 KB |
Wrong Answer: Query(263, 292) - expected : 653448456, actual : 707285324. |
6 |
Incorrect |
432 ms |
4436 KB |
Wrong Answer: Query(738, 741) - expected : 983692994, actual : 817602611. |
7 |
Partially correct |
431 ms |
4432 KB |
Output isn't correct - number of calls to Secret by Init = 246944, maximum number of calls to Secret by Query = 1 |
8 |
Partially correct |
453 ms |
4524 KB |
Output isn't correct - number of calls to Secret by Init = 246944, maximum number of calls to Secret by Query = 1 |
9 |
Partially correct |
437 ms |
4436 KB |
Output isn't correct - number of calls to Secret by Init = 246944, maximum number of calls to Secret by Query = 1 |
10 |
Partially correct |
449 ms |
4436 KB |
Output isn't correct - number of calls to Secret by Init = 246944, maximum number of calls to Secret by Query = 1 |