답안 #707991

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
707991 2023-03-10T17:12:30 Z Dan4Life 비밀 (JOI14_secret) C++17
컴파일 오류
0 ms 0 KB
#include "secret.h"
#include <bits/stdc++.h>
using namespace std;

const int mxN = 1010;
int n, ans[mxN][mxN];

void dnc(int l, int r){
    if(l==r) return;
    int m = (l+r)/2;
    for(int i = m-1; i>=l; i--) ans[i][m] = Secret(ans[i][i],ans[i+1]);
    for(int i = m+1; i<=r; i++) ans[m+1][i] = Secret(ans[i][i],ans[m+1][i-1]);
    dnc(l,m), dnc(m+1,r);
}

int dnc2(int l, int r, int L, int R){
    if(l==r) return ans[l][r];
    int m = (l+r)/2;
    if(L<=m and m<=R)
        return Secret(ans[l][m],ans[m+1][r]);
    if(m<L) return dnc2(l,m,L,R);
    return dnc2(m+1,r,L,R);
}

void Init(int N, int A[]) {
    for(int i = 0; i < N; i++)
        ans[i][i]=A[i];
    dnc(1,N); n=N;
}

int Query(int L, int R) {
    if(L==R) return ans[L][L];
    return dnc2(1,n,L,R);
}

Compilation message

secret.cpp: In function 'void dnc(int, int)':
secret.cpp:11:69: error: invalid conversion from 'int*' to 'int' [-fpermissive]
   11 |     for(int i = m-1; i>=l; i--) ans[i][m] = Secret(ans[i][i],ans[i+1]);
      |                                                              ~~~~~~~^
      |                                                                     |
      |                                                                     int*
In file included from secret.cpp:1:
secret.h:7:23: note:   initializing argument 2 of 'int Secret(int, int)'
    7 | int Secret(int X, int Y);
      |                   ~~~~^