답안 #522444

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
522444 2022-02-05T03:54:56 Z dongliu0426 비밀 (JOI14_secret) C++17
컴파일 오류
0 ms 0 KB
#include <stdio.h>

#define N	1000
#define L	9

int ll[N + 1], tt[L + 1][N];

void Init(int n, int *aa) {
	int i, j;

	for (i = 2; i <= n; i++)
		ll[i] = ll[i >> 1] + 1;
	for (i = 0; i < n; i++)
		tt[0][i] = aa[i];
	for (j = 1; 1 << j <= n; j++)
		for (i = 0; i + (1 << j) <= n; i++)
			tt[j][i] = Secret(tt[j - 1][i], tt[j - 1][i + (1 << j - 1)]);
}

int Query(int l, int r) {
	int d = ll[r - l + 1];

	return Secret(tt[d][l], tt[d][r - (1 << d) + 1]);
}

Compilation message

secret.cpp: In function 'void Init(int, int*)':
secret.cpp:17:58: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
   17 |    tt[j][i] = Secret(tt[j - 1][i], tt[j - 1][i + (1 << j - 1)]);
      |                                                        ~~^~~
secret.cpp:17:15: error: 'Secret' was not declared in this scope
   17 |    tt[j][i] = Secret(tt[j - 1][i], tt[j - 1][i + (1 << j - 1)]);
      |               ^~~~~~
secret.cpp: In function 'int Query(int, int)':
secret.cpp:23:9: error: 'Secret' was not declared in this scope
   23 |  return Secret(tt[d][l], tt[d][r - (1 << d) + 1]);
      |         ^~~~~~