답안 #720294

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
720294 2023-04-07T21:41:53 Z swagchicken 비밀 (JOI14_secret) C++14
0 / 100
451 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], curr);
    }
    curr = pre[m+1][m+1];
    for(int i = m+2; i <= R; i++) {
        pre[m][i] = Secret(curr, A[i]);
    }
    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 113 ms 4412 KB Wrong Answer: Query(222, 254) - expected : 34031541, actual : 536870912.
2 Incorrect 116 ms 4508 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 0.
3 Incorrect 121 ms 4368 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 536870912.
4 Incorrect 410 ms 8208 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 536870912.
5 Incorrect 448 ms 8212 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 536870912.
6 Incorrect 417 ms 8268 KB Wrong Answer: Query(738, 741) - expected : 983692994, actual : 942318537.
7 Incorrect 427 ms 8280 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 0.
8 Incorrect 451 ms 8268 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 536870912.
9 Incorrect 439 ms 8344 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 0.
10 Incorrect 437 ms 8196 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 0.