답안 #70280

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
70280 2018-08-22T14:40:32 Z MladenP 비밀 (JOI14_secret) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#include "secret.h"
#define mid (l+r)/2
#define I int
#define G return
using namespace std;
int n, i, a[1010], d[1010][1010];
void Z(int l, int r) {
	if(l >= r) return;
	for(i = mid+1; i <= r; i++) d[mid][i] = Secret(d[mid][i-1], a[i]);
	for(i = mid-2; i >= l; i--) d[i][mid-1] = Secret(a[i], d[i+1][mid-1]);
	Z(l, mid-1);Z(mid+1, r);
}
I Init(I N, I *A){for(i=0,n=N-1;i<N;i++)a[i]=A[i],d[i][i]=a[i];Z(0,n);}
int query(int l, int r, int L, int R) {
	if(L < mid && mid <= R) return Secret(d[L][mid-1],d[mid][R]);
	if(L == mid) return d[mid][R];
	if(mid < L) return query(mid+1, r, L, R);
	return query(l, mid-1, L, R);
}
I Query(I L,I R){G query(0,n,L,R);}

Compilation message

secret.cpp: In function 'int Init(int, int*)':
secret.cpp:14:3: error: ambiguating new declaration of 'int Init(int, int*)'
 I Init(I N, I *A){for(i=0,n=N-1;i<N;i++)a[i]=A[i],d[i][i]=a[i];Z(0,n);}
   ^~~~
In file included from secret.cpp:2:0:
secret.h:4:6: note: old declaration 'void Init(int, int*)'
 void Init(int N, int A[]);
      ^~~~
secret.cpp:14:71: warning: no return statement in function returning non-void [-Wreturn-type]
 I Init(I N, I *A){for(i=0,n=N-1;i<N;i++)a[i]=A[i],d[i][i]=a[i];Z(0,n);}
                                                                       ^