# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
239193 |
2020-06-14T18:42:41 Z |
rqi |
Secret (JOI14_secret) |
C++14 |
|
507 ms |
4600 KB |
#include "secret.h"
#include <bits/stdc++.h>
int A[1005];
int val[1005][10];
int N;
void build(int L, int R, int lvl = 0){
if(L > R) return;
if(L == R){
val[L][lvl] = A[L];
return;
}
int M = (L+R)/2;
val[M][lvl] = A[M];
for(int i = M-1; i >= L; i--){
val[i][lvl] = Secret(A[i], val[i+1][lvl]);
}
val[M+1][lvl] = A[M+1];
for(int i = M+2; i <= R; i++){
val[i][lvl] = Secret(val[i-1][lvl], A[i]);
}
build(L, M-1, lvl+1);
build(M+2, R, lvl+1);
}
int query(int l, int r, int L = 0, int R = N-1, int lvl = 0){
int M = (L+R)/2;
if(r <= M-1){
return query(l, r, L, M-1, lvl+1);
}
if(l >= M+2){
return query(l, r, M+1, R, lvl+1);
}
if(l >= M+1){
return val[r][lvl];
}
if(r <= M){
return val[l][lvl];
}
return Secret(val[l][lvl], val[r][lvl]);
}
void Init(int _N, int a[]) {
N = _N;
for(int i = 0; i < N; i++) A[i] = a[i];
build(0, N-1);
}
int Query(int L, int R) {
return query(L, R);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
147 ms |
2680 KB |
Output is correct - number of calls to Secret by Init = 3084, maximum number of calls to Secret by Query = 1 |
2 |
Incorrect |
136 ms |
2684 KB |
Wrong Answer: Query(448, 474) - expected : 776677546, actual : 57381937. |
3 |
Incorrect |
139 ms |
2552 KB |
Wrong Answer: Query(130, 131) - expected : 127065177, actual : 972968433. |
4 |
Incorrect |
497 ms |
4484 KB |
Wrong Answer: Query(172, 187) - expected : 590352579, actual : 668684337. |
5 |
Incorrect |
492 ms |
4600 KB |
Wrong Answer: Query(626, 678) - expected : 512755800, actual : 160483352. |
6 |
Incorrect |
497 ms |
4476 KB |
Wrong Answer: Query(915, 915) - expected : 282904741, actual : 0. |
7 |
Correct |
507 ms |
4488 KB |
Output is correct - number of calls to Secret by Init = 6996, maximum number of calls to Secret by Query = 1 |
8 |
Correct |
505 ms |
4444 KB |
Output is correct - number of calls to Secret by Init = 6996, maximum number of calls to Secret by Query = 1 |
9 |
Correct |
502 ms |
4552 KB |
Output is correct - number of calls to Secret by Init = 6996, maximum number of calls to Secret by Query = 1 |
10 |
Correct |
502 ms |
4472 KB |
Output is correct - number of calls to Secret by Init = 6996, maximum number of calls to Secret by Query = 1 |