답안 #954524

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
954524 2024-03-28T06:01:16 Z IBory 비밀 (JOI14_secret) C++17
0 / 100
388 ms 4972 KB
#include "secret.h"
#include <bits/stdc++.h>
#define pii pair<int, int>
using namespace std;

map<pii, int> D;
int N;

void DnC1(int L, int R) {
    if (L >= R) return;
    int mid = (L + R) >> 1;

    for (int i = mid - 1; i >= L; --i) D[{i, mid}] = Secret(i, mid);
    for (int i = mid + 2; i <= R; ++i) D[{mid, i}] = Secret(mid, i);

    DnC1(L, mid);
    DnC1(mid + 1, R);
}

void Init(int _N, int A[]) {
    N = _N;
    DnC1(0, N - 1);
    for (int i = 0; i < N; ++i) D[{i, i}] = A[i];
}

int DnC2(int L, int R, int s, int e) {
    if (L >= R) return -1;
    int mid = (L + R) >> 1;

    if (s <= mid && mid < e) {
        int a = D[{s, mid}], b = D[{mid + 1, e}];
        return Secret(a, b);
    }

    if (e <= mid) return DnC2(L, mid, s, e);
    else return DnC2(mid + 1, R, s, e);
}


int Query(int L, int R) {
    return DnC2(0, N - 1, L, R);
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 99 ms 2900 KB Wrong Answer: Query(222, 254) - expected : 34031541, actual : 554967824.
2 Incorrect 99 ms 2816 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 303280264.
3 Incorrect 97 ms 2948 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 16843072.
4 Incorrect 370 ms 4856 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 9044733.
5 Incorrect 368 ms 4948 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 652251136.
6 Incorrect 364 ms 4860 KB Wrong Answer: Query(915, 915) - expected : 282904741, actual : -1.
7 Incorrect 374 ms 4852 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 687873067.
8 Incorrect 388 ms 4848 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 75653320.
9 Incorrect 373 ms 4852 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 546843023.
10 Incorrect 365 ms 4972 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 878430091.