답안 #754011

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
754011 2023-06-06T13:23:29 Z Zflop 비밀 (JOI14_secret) C++14
컴파일 오류
0 ms 0 KB
const int NMAX = (int)1e3;
int prec[NMAX][NMAX];
void DC	(int l,int r){
	if(l >= r) return;
	int m = (l + r) / 2;
	prec[m][m] = A[m];
	prec[m + 1][m + 1] = A[m + 1];
	for (int i = m - 1; i >= l;--i) prec[i][m] = Secret(prec[i + 1][m],A[i]);
	for (int i = m + 2; i <= r;++i) prec[m][i] = Secret(prec[m + 1][i - 1],A[i]);
	DC(l,m);
	DC(m + 1,r);
	}
void init(int N,int A[]){
	int N; cin >> N;
	DC(0,N - 1);
}
int Query(int L,int R){
	int l = 0,r = N - 1;
	while(true){
		int m = (l + r) / 2;
		if(L <= m && m < R) return Secret(prec[L][m],prec[m + 1],R); 
		if(R < m) r = m;
		else l = m;
	}

Compilation message

secret.cpp: In function 'void DC(int, int)':
secret.cpp:6:15: error: 'A' was not declared in this scope
    6 |  prec[m][m] = A[m];
      |               ^
secret.cpp:8:47: error: 'Secret' was not declared in this scope
    8 |  for (int i = m - 1; i >= l;--i) prec[i][m] = Secret(prec[i + 1][m],A[i]);
      |                                               ^~~~~~
secret.cpp:9:47: error: 'Secret' was not declared in this scope
    9 |  for (int i = m + 2; i <= r;++i) prec[m][i] = Secret(prec[m + 1][i - 1],A[i]);
      |                                               ^~~~~~
secret.cpp: In function 'void init(int, int*)':
secret.cpp:14:6: error: declaration of 'int N' shadows a parameter
   14 |  int N; cin >> N;
      |      ^
secret.cpp:13:15: note: 'int N' previously declared here
   13 | void init(int N,int A[]){
      |           ~~~~^
secret.cpp:14:9: error: 'cin' was not declared in this scope
   14 |  int N; cin >> N;
      |         ^~~
secret.cpp: In function 'int Query(int, int)':
secret.cpp:18:16: error: 'N' was not declared in this scope
   18 |  int l = 0,r = N - 1;
      |                ^
secret.cpp:21:30: error: 'Secret' was not declared in this scope
   21 |   if(L <= m && m < R) return Secret(prec[L][m],prec[m + 1],R);
      |                              ^~~~~~
secret.cpp:24:2: error: expected '}' at end of input
   24 |  }
      |  ^
secret.cpp:17:23: note: to match this '{'
   17 | int Query(int L,int R){
      |                       ^