# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
25306 |
2017-06-21T06:18:23 Z |
kajebiii |
Secret (JOI14_secret) |
C++14 |
|
689 ms |
5388 KB |
#include "secret.h"
const int MAX_N = 1e3 + 100;
const int ROOT_N = 32;
int inQ[MAX_N / ROOT_N][ROOT_N][ROOT_N];
int left[MAX_N / ROOT_N][ROOT_N][MAX_N / ROOT_N];
void Init(int N, int A[]) {
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<ROOT_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<N && 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<ROOT_N; i++)
left[g][i][g] = inQ[g][0][i];
for(int i=0; b+i<N && i<ROOT_N; i++) {
for(int gg=g-1; gg>=0; gg--)
left[g][i][gg] = Secret(inQ[gg][0][ROOT_N-1], left[g][i][gg+1]);
}
}
}
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]);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
183 ms |
5388 KB |
Output isn't correct - number of calls to Secret by Init = 11730, maximum number of calls to Secret by Query = 1 |
2 |
Incorrect |
193 ms |
5388 KB |
Output isn't correct - number of calls to Secret by Init = 11776, maximum number of calls to Secret by Query = 1 |
3 |
Incorrect |
183 ms |
5388 KB |
Output isn't correct - number of calls to Secret by Init = 11792, maximum number of calls to Secret by Query = 1 |
4 |
Incorrect |
689 ms |
5388 KB |
Output isn't correct - number of calls to Secret by Init = 30494, maximum number of calls to Secret by Query = 1 |
5 |
Incorrect |
646 ms |
5388 KB |
Output isn't correct - number of calls to Secret by Init = 30532, maximum number of calls to Secret by Query = 1 |
6 |
Incorrect |
639 ms |
5388 KB |
Output isn't correct - number of calls to Secret by Init = 30532, maximum number of calls to Secret by Query = 1 |
7 |
Incorrect |
649 ms |
5388 KB |
Output isn't correct - number of calls to Secret by Init = 30532, maximum number of calls to Secret by Query = 1 |
8 |
Incorrect |
643 ms |
5388 KB |
Output isn't correct - number of calls to Secret by Init = 30532, maximum number of calls to Secret by Query = 1 |
9 |
Incorrect |
643 ms |
5388 KB |
Output isn't correct - number of calls to Secret by Init = 30532, maximum number of calls to Secret by Query = 1 |
10 |
Incorrect |
646 ms |
5388 KB |
Output isn't correct - number of calls to Secret by Init = 30532, maximum number of calls to Secret by Query = 1 |