제출 #1229908

#제출 시각아이디문제언어결과실행 시간메모리
1229908MuhammadSarampopa (BOI18_popa)C++20
컴파일 에러
0 ms0 KiB
// #include "popa.h"
#include <bits/stdc++.h>

using namespace std;

const int M = 1001;

int pr[M], nx[M];

int solve(int n,int* l,int* r)
{
	for (int i=0;i<n;i++)
	{
		int s=i,e=n;
		while (s+1<e)
		{
			int mid=(s+e)/2;
			if (query(i,i,i,mid))
				s=mid;
			else
				e=mid;
		}
		nx[i]=s;
		s=-1,e=i;
		while (s+1<e)
		{
			int mid=(s+e)/2;
			if (query(i,i,mid,i))
				e=mid;
			else
				s=mid;
		}
		pr[i]=e;
	}
	map<pair<int,int>,int> mp;
	queue<pair<int,int>> q;
	q.push({0,n-1});
	while (!q.empty())
	{
		pair<int,int> p=q.front();q.pop();
		for (int i=p.first;i<=p.second;i++)
			if (pr[i]<=p.first && nx[i]>=p.second)
			{
				mp[p]=i;
				if (i>p.first) q.push({p.first,i-1});
				if (i<p.second) q.push({i+1,p.second});
			}
	}
	q.push({0,n-1});
	while (!q.empty())
	{
		pair<int,int> p=q.front();q.pop();
		int u=mp[p];
		if (u>p.first) l[u]=mp[{p.first,u-1}],q.push({p.first,u-1});
		else l[u]=-1;
		if (u<p.second) r[u]=mp[{u+1,p.second}],q.push({u+1,p.second});
		else r[u]=-1;
	}
	return mp[{0,n-1}];
}

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

popa.cpp: In function 'int solve(int, int*, int*)':
popa.cpp:18:29: error: 'query' was not declared in this scope
   18 |                         if (query(i,i,i,mid))
      |                             ^~~~~
popa.cpp:28:29: error: 'query' was not declared in this scope
   28 |                         if (query(i,i,mid,i))
      |                             ^~~~~