답안 #885471

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
885471 2023-12-09T19:51:30 Z Karoot 비밀 (JOI14_secret) C++17
0 / 100
375 ms 8280 KB
#include "secret.h"

const int MAXN = 1e3+1;
int SRQ[MAXN][MAXN];
int Arrl[MAXN];
int globul;

int Secret(int X, int Y);


void initTree(int l, int r){
    if (l == r)return;
    int mid = (l+r)>>1;
    SRQ[mid][mid] = Arrl[mid];
    SRQ[mid+1][mid+1] = Arrl[mid+1];
    for (int i = mid-1; i >= l; i--){
        SRQ[mid][i] = Secret(Arrl[i], SRQ[mid][i+1]);
    }
    for (int i = mid+2; i <= r; i++){
        SRQ[mid+1][i] = Secret(Arrl[i], SRQ[mid+1][i-1]);
    }
    initTree(l, mid);
    initTree(mid+1, r);
}

int followInit(int l, int r, int wL, int wR){
    int mid = (l+r)>>1;
    if (mid >= wL && mid < wR)return Secret(SRQ[mid][wL], SRQ[mid+1][wR]);
    if (mid == wR){
        return SRQ[mid][wL];
    }
    if (l == r)return SRQ[0][0];
    if (mid < wL){
        return followInit(mid+1, r, wL, wR);
    }
    return followInit(l, mid, wL, wR);
}

void Init(int N, int A[]){
    for (int i = 0; i < N; i++){
        Arrl[i] = A[i];
    }
    globul = N;
    initTree(0, N-1);
}

int Query(int L, int R){
    return followInit(0, globul-1, L, R);
}

# 결과 실행 시간 메모리 Grader output
1 Incorrect 101 ms 7900 KB Wrong Answer: Query(222, 254) - expected : 34031541, actual : 809782271.
2 Incorrect 105 ms 7480 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 68749376.
3 Incorrect 97 ms 7508 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 136349820.
4 Incorrect 347 ms 8280 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 650789536.
5 Incorrect 352 ms 8272 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 377506838.
6 Incorrect 375 ms 8272 KB Wrong Answer: Query(738, 741) - expected : 983692994, actual : 61461050.
7 Incorrect 350 ms 8276 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 687550570.
8 Incorrect 355 ms 8232 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 145923264.
9 Incorrect 354 ms 8272 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 18757135.
10 Incorrect 352 ms 8264 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 70590726.