# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
110971 |
2019-05-13T12:33:32 Z |
tjd229 |
popa (BOI18_popa) |
C++14 |
|
89 ms |
428 KB |
#include "popa.h"
#include <stack>
using namespace std;
int solve(int N, int *Left, int *Right) {
*Left = -1, *Right = -1;
stack<int> stk; stk.push(0);
int root = 0;
for (int i = 1; i < N; ++i) {
Left[i] = Right[i] = -1;
while (stk.size() && query(i,i,stk.top(),i)) {
//Right[stk.top()] = Left[i];
Left[i] = stk.top();
stk.pop();
}
if (stk.size()) Right[stk.top()] = i;
else root = i;
stk.push(i);
}
return root;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
256 KB |
Output is correct |
2 |
Correct |
9 ms |
256 KB |
Output is correct |
3 |
Correct |
8 ms |
384 KB |
Output is correct |
4 |
Correct |
8 ms |
256 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
89 ms |
308 KB |
Output is correct |
2 |
Correct |
79 ms |
392 KB |
Output is correct |
3 |
Correct |
54 ms |
256 KB |
Output is correct |
4 |
Correct |
83 ms |
256 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
58 ms |
308 KB |
Output is correct |
2 |
Correct |
80 ms |
256 KB |
Output is correct |
3 |
Correct |
68 ms |
316 KB |
Output is correct |
4 |
Correct |
78 ms |
428 KB |
Output is correct |