# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
25277 |
2017-06-21T05:46:20 Z |
kajebiii |
Secret (JOI14_secret) |
C++14 |
|
719 ms |
5364 KB |
#include "secret.h"
#include <stdio.h>
const int MAX_N = 1e3 + 10;
const int ROOT_N = 32;
int inQ[ROOT_N][ROOT_N][ROOT_N];
int left[ROOT_N][ROOT_N][ROOT_N];
void Init(int N, int A[]) {
// for(int i=0; i<N; i++) printf("%d ", A[i]); puts("");
for(int g=0; g<(N+ROOT_N-1)/ROOT_N; g++) {
int b = g * ROOT_N;
for(int i=0; b+i<N; i++)
inQ[g][i][i] = A[b+i];
for(int p=1; p<ROOT_N; p++)
for(int i=0, j=p; b+j<ROOT_N; i++, j++)
inQ[g][i][j] = Secret(inQ[g][i][j-1], A[b+j]);
}
for(int g=0; g<(N+ROOT_N-1)/ROOT_N; g++) {
int b = g * ROOT_N;
for(int i=0; b+i<N; i++)
left[g][i][g] = inQ[g][0][i];
for(int i=0; b+i<N; i++)
for(int gg=g-1; gg>=0; gg--)
left[g][i][gg] = Secret(left[g][i][gg+1], inQ[gg][0][ROOT_N]);
}
}
int Query(int L, int R) {
// printf("[%d %d]\n", L, R);
int gL = L / ROOT_N, gR = R / ROOT_N;
int rL = L % ROOT_N, rR = R % ROOT_N;
if(gL == gR) return inQ[gL][rL][rR];
return Secret(inQ[gL][rL][ROOT_N-1], left[gR][rR][gL+1]);
}
Compilation message
secret.cpp: In function 'void Init(int, int*)':
secret.cpp:25:40: warning: array subscript is above array bounds [-Warray-bounds]
left[g][i][gg] = Secret(left[g][i][gg+1], inQ[gg][0][ROOT_N]);
^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
156 ms |
5364 KB |
Wrong Answer: Query(222, 254) - expected : 34031541, actual : 38994019. |
2 |
Incorrect |
159 ms |
5364 KB |
Wrong Answer: Query(60, 375) - expected : 669221184, actual : 466104448. |
3 |
Incorrect |
159 ms |
5364 KB |
Wrong Answer: Query(211, 401) - expected : 674373968, actual : 495221114. |
4 |
Incorrect |
706 ms |
5364 KB |
Wrong Answer: Query(90, 497) - expected : 397934825, actual : 655425733. |
5 |
Incorrect |
716 ms |
5364 KB |
Wrong Answer: Query(587, 915) - expected : 752404486, actual : 589062480. |
6 |
Incorrect |
683 ms |
5364 KB |
Wrong Answer: Query(738, 741) - expected : 983692994, actual : 0. |
7 |
Incorrect |
719 ms |
5364 KB |
Wrong Answer: Query(84, 976) - expected : 742463504, actual : 251374624. |
8 |
Incorrect |
716 ms |
5364 KB |
Wrong Answer: Query(58, 987) - expected : 20022464, actual : 564330704. |
9 |
Incorrect |
696 ms |
5364 KB |
Wrong Answer: Query(33, 967) - expected : 676869696, actual : 156246881. |
10 |
Incorrect |
713 ms |
5364 KB |
Wrong Answer: Query(116, 961) - expected : 68487362, actual : 878579017. |