#include <bits/stdc++.h>
#include "popa.h"
using namespace std;
int solve(int N, int* Left, int* Right) {
stack<int>s;
s.push(0);
int prv = -1;
for(int i=1; i<N; ++i) {
while(!s.empty() && query(s.top(), i, i, i)) {
prv = s.top();
s.pop();
}
Left[i] = prv;
if(!s.empty()) Right[s.top()] = i;
s.push(i);
}
while(s.size() > 1) s.pop();
return s.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... |