답안 #1031999

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1031999 2024-07-23T09:39:46 Z juicy 비밀 (JOI14_secret) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include "debug.h"
#else
#define debug(...) 42
#endif

int n;
int a[1000], F[1000][1000];

void dc(int l = 0, int r = n - 1) {
	if (l == r) {
		return;
	}
	int md = (l + r) / 2;
	F[md][md] = a[md];
	F[md + 1][md] = a[md + 1]; 
	for (int i = md - 1; i >= l; --i) {
		F[i][md] = Secret(a[i], F[i + 1][md]);
	}
	for (int i = md + 2; i <= r; ++i) {
		F[i][md] = Secret(a[i], F[i - 1][md]);
	}
	dc(l, md);
	dc(md + 1, r);
}

int Query(int L, int R) {
	for (int K = L; K < R; ++K) {
		if (F[L][K] != -1 && F[R][K] != -1) {
			return Secret(F[L][K], F[R][K]);
		}
	} 
	return a[L];
}

void Init(int _n, int *A) {
	n = _n;
	for (int i = 0; i < n; ++i) {
		a[i] = A[i];
	}
	memset(F, -1, sizeof(F));
	dc();
}

Compilation message

secret.cpp: In function 'void dc(int, int)':
secret.cpp:22:14: error: 'Secret' was not declared in this scope
   22 |   F[i][md] = Secret(a[i], F[i + 1][md]);
      |              ^~~~~~
secret.cpp:25:14: error: 'Secret' was not declared in this scope
   25 |   F[i][md] = Secret(a[i], F[i - 1][md]);
      |              ^~~~~~
secret.cpp: In function 'int Query(int, int)':
secret.cpp:34:11: error: 'Secret' was not declared in this scope
   34 |    return Secret(F[L][K], F[R][K]);
      |           ^~~~~~