Submission #92910

# Submission time Handle Problem Language Result Execution time Memory
92910 2019-01-05T14:12:10 Z Pajaraja popa (BOI18_popa) C++17
Compilation error
0 ms 0 KB
#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)
{
	for(int i=0;i<N;i++)
	{
		while(!st.empty()) {if(!query(st.top(),st.top(),st.top(),i)) {dmr[st.top()]=i-1; st.pop();} else break;}
		if(!st.empty()) dml[i]=st.top()+1;
		else dml[i]=0;
		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;
}

Compilation message

popa.cpp: In function 'int solve(int, int*, int*)':
popa.cpp:19:10: error: 'st' was not declared in this scope
   while(!st.empty()) {if(!query(st.top(),st.top(),st.top(),i)) {dmr[st.top()]=i-1; st.pop();} else break;}
          ^~
popa.cpp:20:7: error: 'st' was not declared in this scope
   if(!st.empty()) dml[i]=st.top()+1;
       ^~
popa.cpp:22:3: error: 'st' was not declared in this scope
   st.push(i);
   ^~
popa.cpp:24:9: error: 'st' was not declared in this scope
  while(!st.empty()) {dmr[st.top()]=N-1; st.pop();}
         ^~