답안 #110971

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
110971 2019-05-13T12:33:32 Z tjd229 popa (BOI18_popa) C++14
100 / 100
89 ms 428 KB
#include "popa.h"
#include <stack>
using namespace std;
int solve(int N, int *Left, int *Right) {
	*Left = -1, *Right = -1;
	stack<int> stk; stk.push(0);
	int root = 0;
	for (int i = 1; i < N; ++i) {
		Left[i] = Right[i] = -1;
		while (stk.size() && query(i,i,stk.top(),i)) {
			//Right[stk.top()] = Left[i];
			Left[i] = stk.top();
			stk.pop();
		}
		if (stk.size()) Right[stk.top()] = i;
		else root = i;
		stk.push(i);
	}
	return root;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 256 KB Output is correct
2 Correct 9 ms 256 KB Output is correct
3 Correct 8 ms 384 KB Output is correct
4 Correct 8 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 89 ms 308 KB Output is correct
2 Correct 79 ms 392 KB Output is correct
3 Correct 54 ms 256 KB Output is correct
4 Correct 83 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 58 ms 308 KB Output is correct
2 Correct 80 ms 256 KB Output is correct
3 Correct 68 ms 316 KB Output is correct
4 Correct 78 ms 428 KB Output is correct