Submission #522431

# Submission time Handle Problem Language Result Execution time Memory
522431 2022-02-05T02:46:27 Z ntabc05101 popa (BOI18_popa) C++14
0 / 100
1000 ms 264 KB
#include<bits/stdc++.h>
#include "popa.h"
using namespace std;

#define taskname ""

int solve(int N, int *Left, int *Right) {
	for (int i = 0; i < N; i++) {
		Left[i] = Right[i] = 1;
	}

	vector<int> st(1, 0);
	for (int i = 1; i < N; i++) {
		int y = -1;
		while (!st.empty()) {
			int x = st.back();
			while (~Left[x]) {
				x = Left[x];
			}

			if (query(x, i, st.back(), st.back())) {
				break;
			}
			y = st.back(); st.pop_back();
		}

		if (!st.empty()) {
			Right[st.back()] = i;
		}
		Left[i] = y;
		st.push_back(i);
	}	

	while (st.size() > 1) {
		st.pop_back();
	}
	return st.back();
}
# Verdict Execution time Memory Grader output
1 Execution timed out 3048 ms 200 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3059 ms 200 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3031 ms 264 KB Time limit exceeded
2 Halted 0 ms 0 KB -