답안 #53178

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
53178 2018-06-29T00:19:18 Z okaybody10 비밀 (JOI14_secret) C++
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#include "secret.h"
using namespace std;
int n,B[1006],ans[1006][1006];
void _init(int s,int e)
{
    int m=(s+e)/2;
    if(s==e){
        D[m][m]=B[m];
        return;
    }
    D[m][m]=B[m];
    ans[m+1][m+1]=B[m+1];
    for(int i=m-1;i>=s;i--) ans[i][m]=Secret(ans[i+1][m],B[i]);
    for(int i=m+2;i<=e;i++) ans[m+1][i]=Secret(ans[m+1][i-1],B[i]);
    _init(s,m);
    _init(m+1,e);
}
void Init(int N, int A[]) {
    n=N;
    for(int i=0; i<n; i++) B[i]=A[i];
    _init(0,n-1);
}
int solve(int l,int r,int s,int e)
{
    int m=(s+e)/2;
    if(l<=m && m+1<=r) return Secret(ans[l][m],ans[m+1][r]);
    if(r<=m) return solve(l,r,s,m);
    else return solve(l,r,m+1,e);
}
int Query(int l, int r) {
    if(l==r) return B[r];
    return solve(l,r,0,n-1);
}

Compilation message

secret.cpp: In function 'void _init(int, int)':
secret.cpp:9:9: error: 'D' was not declared in this scope
         D[m][m]=B[m];
         ^
secret.cpp:12:5: error: 'D' was not declared in this scope
     D[m][m]=B[m];
     ^