답안 #386530

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
386530 2021-04-06T18:34:28 Z aryan12 비밀 (JOI14_secret) C++17
컴파일 오류
0 ms 0 KB
#include "secret.h"
#include <bits/stdc++.h>
using namespace std;
#define int long long

const int MAX_N = 1000;

int ans[MAX_N][MAX_N];
int N;

void PreCompute(int left, int right) {
    int mid = (left + right) >> 1;
    if(right - left >= 2)
        return;
    for(int i = mid - 2; i >= left; i--) {
        ans[i][mid - 1] = Secret(ans[i + 1][mid - 1], ans[i][i]);
    }
    for(int i = mid + 1; i <= right; i++) {
        ans[mid][i] = Secret(ans[mid][i - 1], ans[i][i]);
    }
    Precompute(left, mid - 1);
    Precompute(mid + 1, right);
}

void Init(int n, int A[]) {
    N = n;
    for(int i = 0; i < N; i++) {
        for(int j = i; j < N; j++) {
            ans[i][j] = (i == j) ? A[i] : -1; 
        }
    }
    PreCompute(0, N - 1);
}

int Compute(int left, int right, int ql, int qr) {
    int mid = (left + right) >> 1;
    if(ql >= mid) {
        return Compute(mid, right, ql, qr);
    }
    else if(qr < mid) {
        return Compute(left, mid, ql, qr);
    }
    return Secret(ans[ql][mid - 1], ans[mid][qr]);
}

int Query(int L, int R) {
    if(L == R)
        return ans[L][L];
    return Compute(0, N - 1, L, R);
}

Compilation message

secret.cpp: In function 'void PreCompute(long long int, long long int)':
secret.cpp:21:5: error: 'Precompute' was not declared in this scope; did you mean 'PreCompute'?
   21 |     Precompute(left, mid - 1);
      |     ^~~~~~~~~~
      |     PreCompute