Submission #751906

# Submission time Handle Problem Language Result Execution time Memory
751906 2023-06-01T18:44:56 Z Markomafko972 Secret (JOI14_secret) C++17
Compilation error
0 ms 0 KB
#include "secret.h"
#include <bits/stdc++.h>
using namespace std;

int val[1005][1005];
int sus[1005][1005];

void rek(int l, int r) {
	if (l >= r) return;
	
	int mid = (l+r)/2;
	for (int i = l; i <= mid; i++) {
		for (int j = mid+1; j <= r; j++) {
			sus[i][j] = mid;
		}
	}
	
	for (int j = mid-1; j >= l; j--) {
		val[j][mid] = Secret(val[j+1][mid], val[j][j]);
	}
	for (int j = mid+2; j <= r; j++) {
		val[mid+1][j] = Secret(val[mid+1][j-1], val[j][j]);
	}
 
	rek(l, mid);
	rek(mid+1, r);
}
 
void Init(int N, int A[]) {
	memset(val, -1, sizeof val);
	for (int i = 0; i < n; i++) {
		val[i][i] = A[i];
	}
	rek(0, N-1);
}
 
int Query(int l, int r) {
	if (val[l][r] != -1) return val[l][r];
	return Secret(val[l][sus[l][r]], val[sus[l][r]+1][r]);
}

Compilation message

secret.cpp: In function 'void Init(int, int*)':
secret.cpp:31:22: error: 'n' was not declared in this scope
   31 |  for (int i = 0; i < n; i++) {
      |                      ^