제출 #1241475

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

using namespace std;

int solve(int n, int* left, int* right) {
	int rad = -1;
	stack<int> s;
	for (int i = 0; i < n; i ++) {
		left[i] = right[i] = -1;
		while (s.size() && query(i, i, s.top(), i)) {
			right[s.top()] = left[i];
			left[i] = s.top();
			s.pop();
		}
		if (s.size()) 
			right[s.top()] = i;
		else 
			root = i;
		s.push(i);
	}
	return root;
}

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

popa.cpp: In function 'int solve(int, int*, int*)':
popa.cpp:19:25: error: 'root' was not declared in this scope
   19 |                         root = i;
      |                         ^~~~
popa.cpp:22:16: error: 'root' was not declared in this scope
   22 |         return root;
      |                ^~~~