제출 #92902

#제출 시각아이디문제언어결과실행 시간메모리
92902Pajarajapopa (BOI18_popa)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
#include "popa.h"
#define MAXN 1007
using namespace std;
int ls[MAXN],rs[MAXN],dml[MAXN],dmr[MAXN];
int rek(int lt,int rt)
{
	if(lt>rt) return -1;
	int l;
	for(int i=lt;i<=rt;i++) {if(dml[i]<=lt && dmr[i]>=rt)  l=i; break;}
	ls[l]=rek(lt,l-1);
	rs[l]=rek(l+1,rt);
	return l;
}
int solve(int N,int* Left,int* Right)
{
	stack<int> st; st.push(-1);	
	for(int i=0;i<N;i++)
	{
		while(st.size()>1 && !query(st.top(),st.top(),st.top(),i)) {dmr[st.top()]=i-1; st.pop();}
		dml[i]=st.top()+1;
		st.push(i);
	}
	while(!st.empty()) {dmr[st.top()]=n-1; st.pop();}
	int a=rek(0,N-1);
	for(int i=0;i<N;i++) Left[i]=ls[i];
	for(int i=0;i<N;i++) Right[i]=rs[i];
	return a;
}

컴파일 시 표준 에러 (stderr) 메시지

popa.cpp: In function 'int solve(int, int*, int*)':
popa.cpp:24:36: error: 'n' was not declared in this scope
  while(!st.empty()) {dmr[st.top()]=n-1; st.pop();}
                                    ^