답안 #885468

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
885468 2023-12-09T19:46:13 Z Karoot 비밀 (JOI14_secret) C++17
컴파일 오류
0 ms 0 KB
#include "secret.h"

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

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

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

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);
}


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

Compilation message

secret.cpp: In function 'void initTree(int, int)':
secret.cpp:14:23: error: 'secret' was not declared in this scope; did you mean 'Secret'?
   14 |         SRQ[mid][i] = secret(Ar[i], SRQ[mid][i+1]);
      |                       ^~~~~~
      |                       Secret
secret.cpp:17:25: error: 'secret' was not declared in this scope; did you mean 'Secret'?
   17 |         SRQ[mid+1][i] = secret(Ar[i], SRQ[mid+1][i-1]);
      |                         ^~~~~~
      |                         Secret
secret.cpp: In function 'int followInit(int, int, int, int)':
secret.cpp:33:38: error: 'secret' was not declared in this scope; did you mean 'Secret'?
   33 |     if (mid >= wL && mid < wR)return secret(SRQ[mid][wL], SRQ[mid+1][wR]);
      |                                      ^~~~~~
      |                                      Secret
secret.cpp: In function 'int Query(int, int)':
secret.cpp:46:36: error: 'l' was not declared in this scope
   46 |     return followInit(0, globul-1, l, r);
      |                                    ^
secret.cpp:46:39: error: 'r' was not declared in this scope
   46 |     return followInit(0, globul-1, l, r);
      |                                       ^