답안 #720295

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
720295 2023-04-07T21:42:54 Z swagchicken 비밀 (JOI14_secret) C++14
0 / 100
421 ms 8344 KB
#include "secret.h"

int n;
int pre[1010][1010] = {};

void process(int L, int R, int A[]) {
    if(L == R) return;

    int m = (L + R)/2;

    pre[m][m] = A[m];
    pre[m+1][m+1] = A[m+1];
    int curr = pre[m][m];
    for(int i = m-1; i >= L; i--) {
        pre[m][i] = Secret(A[i], pre[m][i+1]);
    }
    curr = pre[m+1][m+1];
    for(int i = m+2; i <= R; i++) {
        pre[m][i] = Secret(curr, pre[m][i-1]);
    }
    process(L, m, A);
    process(m+1, R, A);
}   

void Init(int N, int A[]) {
    n = N;
    process(0, N-1, A);
}

int Query(int L, int R) {

    int lo = 0, hi = n-1;

    while(lo < hi) {
        int mid = (lo + hi)/2;
        if(L <= mid && R >= mid + 1) {
            return Secret(pre[L][mid], pre[mid+1][R]);
        } else if(R == mid) {
            return pre[L][mid];
        }

        if(R < mid + 1) {
            hi = mid;
        } else {
            lo = mid + 1;
        }
    }

    return pre[lo][lo];

}

# 결과 실행 시간 메모리 Grader output
1 Incorrect 112 ms 4304 KB Wrong Answer: Query(222, 254) - expected : 34031541, actual : 536870912.
2 Incorrect 110 ms 4312 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 0.
3 Incorrect 111 ms 4456 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 536870912.
4 Incorrect 412 ms 8212 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 536870912.
5 Incorrect 417 ms 8156 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 536870912.
6 Incorrect 421 ms 8344 KB Wrong Answer: Query(738, 741) - expected : 983692994, actual : 942318537.
7 Incorrect 419 ms 8232 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 0.
8 Incorrect 418 ms 8196 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 536870912.
9 Incorrect 419 ms 8224 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 0.
10 Incorrect 417 ms 8248 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 0.