답안 #740278

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
740278 2023-05-12T09:19:00 Z BidoTeima 비밀 (JOI14_secret) C++17
0 / 100
451 ms 8248 KB
#include "secret.h"
#include <bits/stdc++.h>
const int N = 1e3;
int val[N][N];
int a[N];
void rec(int l, int r){
    if(l == r){
        val[l][l] = a[l];
        return;
    }
    int mid = (l + r) >> 1;
    // (l, mid), (l + 1, mid), ..., (mid, mid)
    int pre = a[l];
    for(int i = l; i <= mid; i++){
        if(i > l)pre = Secret(pre, a[i]);
        val[l][i] = pre;
    }
    pre = a[mid + 1];
    for(int i = mid + 1; i <= r; i++){
        if(i > mid + 1)pre = Secret(pre, a[i]);
        val[mid + 1][i] = pre;
    }
    rec(l, mid);
    rec(mid + 1, r);
}
void Init(int n, int A[]) {
    for(int i = 0; i < n; i++){
        a[i] = A[i];
    }
    memset(val, -1, sizeof(val));
    rec(0, n - 1);
}

int Query(int L, int R) {
    if(L == R)
        return val[L][L];
    for(int i = L; i <= R; i++){
        if(val[L][i] != -1)
            return Secret(val[L][i], val[i + 1][R]);
    }
    return -1;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 115 ms 6212 KB Wrong Answer [1]
2 Incorrect 130 ms 6252 KB Wrong Answer [1]
3 Incorrect 127 ms 6236 KB Wrong Answer [1]
4 Incorrect 451 ms 8232 KB Wrong Answer [1]
5 Incorrect 435 ms 8116 KB Wrong Answer [1]
6 Incorrect 446 ms 8192 KB Wrong Answer [1]
7 Incorrect 433 ms 8248 KB Wrong Answer [1]
8 Incorrect 447 ms 8168 KB Wrong Answer [1]
9 Incorrect 431 ms 8176 KB Wrong Answer [1]
10 Incorrect 429 ms 8076 KB Wrong Answer [1]