답안 #25302

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
25302 2017-06-21T06:12:19 Z kajebiii 비밀 (JOI14_secret) C++14
0 / 100
776 ms 6172 KB
#include "secret.h"
#include <stdio.h>

const int MAX_N = 1e3 + 100;
const int ROOT_N = 300;

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 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<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 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]);
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 253 ms 6172 KB Output isn't correct - number of calls to Secret by Init = 67216, maximum number of calls to Secret by Query = 1
2 Incorrect 259 ms 6172 KB Output isn't correct - number of calls to Secret by Init = 67428, maximum number of calls to Secret by Query = 1
3 Incorrect 246 ms 6172 KB Output isn't correct - number of calls to Secret by Init = 67641, maximum number of calls to Secret by Query = 1
4 Runtime error 769 ms 6172 KB Execution killed with signal 11 (could be triggered by violating memory limits)
5 Runtime error 759 ms 6172 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Runtime error 763 ms 6172 KB Execution killed with signal 11 (could be triggered by violating memory limits)
7 Runtime error 776 ms 6172 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Runtime error 773 ms 6172 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Runtime error 746 ms 6172 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 763 ms 6172 KB Execution killed with signal 11 (could be triggered by violating memory limits)