제출 #287716

#제출 시각아이디문제언어결과실행 시간메모리
287716luciocfpopa (BOI18_popa)C++14
100 / 100
101 ms500 KiB
#include <bits/stdc++.h>
#include "popa.h"
 
using namespace std;
 
int solve(int n, int *l, int *r)
{
	stack<int> stk;
 
	for (int i = 0; i < n; i++)
	{
		l[i] = r[i] = -1;

		while (stk.size() && query(stk.top(), i, i, i))
		{
			l[i] = stk.top();
			stk.pop();
		}
 
		if (stk.size()) r[stk.top()] = i;
 
		stk.push(i);
	}
 
 	int root;

 	while (stk.size())
 	{
 		root = stk.top();
 		stk.pop();
 	}

 	return root;
}

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

popa.cpp: In function 'int solve(int, int*, int*)':
popa.cpp:33:10: warning: 'root' may be used uninitialized in this function [-Wmaybe-uninitialized]
   33 |   return root;
      |          ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...