#include <bits/stdc++.h>
#include "popa.h"
using namespace std;
int solve(int n, int* left, int* right) {
vector<int> st;
int root = -1;
for (int i = 0; i < n; i++) {
left[i] = right[i] = -1;
while (st.size() && query(st.back(), i, i, i)) {
right[st.back()] = left[i];
left[i] = st.back();
st.pop_back();
}
if (st.size()) right[st.back()] = i;
else root = i;
st.push_back(i);
}
return root;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
12 ms |
248 KB |
Output is correct |
2 |
Correct |
14 ms |
308 KB |
Output is correct |
3 |
Correct |
21 ms |
472 KB |
Output is correct |
4 |
Correct |
13 ms |
552 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
94 ms |
552 KB |
Output is correct |
2 |
Correct |
125 ms |
552 KB |
Output is correct |
3 |
Correct |
54 ms |
552 KB |
Output is correct |
4 |
Correct |
89 ms |
552 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
134 ms |
624 KB |
Output is correct |
2 |
Correct |
99 ms |
624 KB |
Output is correct |
3 |
Correct |
93 ms |
624 KB |
Output is correct |
4 |
Correct |
134 ms |
628 KB |
Output is correct |