#include "popa.h"
#include <bits/stdc++.h>
using namespace std;
int solve(int N, int* Left, int* Right) {
stack<int> stk;
stk.push(0);
for (int i = 0; i < N; i++) Left[i] = -1, Right[i] = -1;
for (int i = 1; i < N; i++) {
int prev = -1;
while (stk.size() && query(stk.top(), i, i, i)) prev = stk.top(), stk.pop();
Left[i] = prev;
if (stk.size()) Right[stk.top()] = i;
stk.push(i);
}
while (stk.size() > 1) stk.pop();
return stk.top();
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |