답안 #984431

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
984431 2024-05-16T16:17:36 Z LOLOLO 비밀 (JOI14_secret) C++11
0 / 100
357 ms 8280 KB
//#include <bits/stdc++.h>
#include "secret.h"
using namespace std;
const int N = 1e3 + 10;
int n;
int a[N], f[N][N];

void prepare(int l, int r) {
    if (l == r) {
        f[l][l] = a[l];
        return;
    }

    int m = (l + r) / 2;

    f[m][m] = a[m];
    f[m + 1][m + 1] = a[m + 1];

    for (int j = m + 2; j <= r; j++) {
        f[m + 1][j] = Secret(f[m + 1][j - 1], a[j]);
    }

    for (int j = m - 1; j >= l; j--) {
        f[j][m] = Secret(f[j + 1][m], a[j]);
    }

    prepare(l, m);
    prepare(m + 1, r); 
}

void Init(int _n, int _a[]) {
    n = _n;
    for (int i = 0; i < n; i++)
        a[i] = _a[i];

    prepare(0, n - 1);
}

int get(int l, int r, int u, int v) {
    int m = (l + r) / 2;
    if (m < u)
        return get(m + 1, r, u, v);

    if (m > v)
        return get(l, m, u, v);

    if (v == m)
        return f[u][v];

    return Secret(f[u][m], f[m + 1][v]);
}

int Query(int l, int r) {
    if (l == r) {
        return a[l];
    }

    return get(0, n - 1, l, r);
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 97 ms 7508 KB Wrong Answer: Query(113, 206) - expected : 536899947, actual : 538256673.
2 Incorrect 96 ms 7684 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 311474560.
3 Incorrect 96 ms 7532 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 353554500.
4 Incorrect 347 ms 8192 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 343081568.
5 Incorrect 350 ms 8272 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 957013316.
6 Incorrect 353 ms 8204 KB Wrong Answer: Query(250, 258) - expected : 907404, actual : 997709.
7 Incorrect 350 ms 8280 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 675449873.
8 Incorrect 357 ms 8204 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 273091792.
9 Incorrect 353 ms 8280 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 827853577.
10 Incorrect 350 ms 8272 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 337854787.