#include "popa.h"
#include <bits/stdc++.h>
using namespace std;
const int N = 1005;
int s[N], c;
int solve(int n, int *l, int *r){
int root = -1, c = 0;
for (int u = 0; u < n; ++ u){
l[u] = r[u] = -1;
while (c && query(s[c], u, u, u)){
r[s[c]] = l[u];
l[u] = s[c];
c --;
}
if (!c) root = u;
else r[s[c]] = u;
s[++ c] = u;
}
return root;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |