#include<bits/stdc++.h>
#include "popa.h"
using namespace std;
int solve(int n , int *Left , int *Right) {
stack<int> st;
int root = 0;
for(int i = 0; i < n; ++i)Left[i] = Right[i] = -1;
st.push(0);
for(int i =1; i < n; ++i){
while(st.size() && query(st.top() , i , i , i)){
Right[st.top()] = Left[i];
Left[i] = st.top();
st.pop();
}
if(st.size()) Right[st.top()] = i;
else root = i;
st.push(i);
}
return root;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
200 KB |
Output is correct |
2 |
Correct |
11 ms |
200 KB |
Output is correct |
3 |
Correct |
11 ms |
200 KB |
Output is correct |
4 |
Correct |
11 ms |
200 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
104 ms |
292 KB |
Output is correct |
2 |
Correct |
111 ms |
280 KB |
Output is correct |
3 |
Correct |
81 ms |
200 KB |
Output is correct |
4 |
Correct |
87 ms |
316 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
113 ms |
200 KB |
Output is correct |
2 |
Correct |
90 ms |
400 KB |
Output is correct |
3 |
Correct |
58 ms |
280 KB |
Output is correct |
4 |
Correct |
99 ms |
280 KB |
Output is correct |