# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
25305 |
2017-06-21T06:15:27 Z |
kajebiii |
Secret (JOI14_secret) |
C++14 |
|
11976 ms |
9844 KB |
#include "secret.h"
#include <stdio.h>
const int MAX_N = 1e3 + 100;
const int ROOT_N = 1;
int inQ[MAX_N / ROOT_N][ROOT_N][ROOT_N];
int left[MAX_N / ROOT_N][ROOT_N][MAX_N / ROOT_N];
int Nr[MAX_N];
void Init(int N, int A[]) {
// for(int i=0; i<N; i++) printf("%d ", A[i]); puts("");
for(int i=0; i<N; i++) Nr[i] = A[i];
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(left[g][i][gg+1], inQ[gg][0][ROOT_N-1]);
}
}
}
int Query(int L, int R) {
// printf("[%d %d]\n", L, R);
int res = Nr[L];
for(int i=L+1; i<=R; i++) {
res = Secret(res, Nr[i]);
}
return res;
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 |
2599 ms |
9844 KB |
Output isn't correct - number of calls to Secret by Init = 130305, maximum number of calls to Secret by Query = 506 |
2 |
Incorrect |
2233 ms |
9844 KB |
Output isn't correct - number of calls to Secret by Init = 130816, maximum number of calls to Secret by Query = 508 |
3 |
Incorrect |
2306 ms |
9844 KB |
Output isn't correct - number of calls to Secret by Init = 131328, maximum number of calls to Secret by Query = 505 |
4 |
Incorrect |
4893 ms |
9844 KB |
Output isn't correct - number of calls to Secret by Init = 498501, maximum number of calls to Secret by Query = 997 |
5 |
Incorrect |
5029 ms |
9844 KB |
Output isn't correct - number of calls to Secret by Init = 499500, maximum number of calls to Secret by Query = 992 |
6 |
Incorrect |
1263 ms |
9844 KB |
Output isn't correct - number of calls to Secret by Init = 499500, maximum number of calls to Secret by Query = 10 |
7 |
Incorrect |
11976 ms |
9844 KB |
Output isn't correct - number of calls to Secret by Init = 499500, maximum number of calls to Secret by Query = 999 |
8 |
Incorrect |
11059 ms |
9844 KB |
Output isn't correct - number of calls to Secret by Init = 499500, maximum number of calls to Secret by Query = 999 |
9 |
Incorrect |
10973 ms |
9844 KB |
Output isn't correct - number of calls to Secret by Init = 499500, maximum number of calls to Secret by Query = 998 |
10 |
Incorrect |
11616 ms |
9844 KB |
Output isn't correct - number of calls to Secret by Init = 499500, maximum number of calls to Secret by Query = 999 |