# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
122797 |
2019-06-29T09:43:57 Z |
stefdasca |
popa (BOI18_popa) |
C++14 |
|
111 ms |
376 KB |
#include <bits/stdc++.h>
#include "popa.h"
int parent[1005];
int solve(int n, int *left, int *right)
{
for(int i = 0; i < n; i++)
{
left[i] = -1;
right[i] = -1;
parent[i] = -1;
}
int root = -1;
for(int i = 0; i < n; i++)
{
int curr = i - 1;
while(curr != -1 && query(i, i, curr, i))
{
right[curr] = left[i];
parent[left[i]] = curr;
left[i] = curr;
int nxt = parent[curr];
parent[curr] = i;
curr = nxt;
}
if(curr == -1)
{
left[i] = root;
if(root != -1)
parent[root] = i;
root = i;
}
else
{
right[curr] = i;
parent[i] = curr;
}
}
return root;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
11 ms |
248 KB |
Output is correct |
2 |
Correct |
12 ms |
376 KB |
Output is correct |
3 |
Correct |
13 ms |
376 KB |
Output is correct |
4 |
Correct |
12 ms |
296 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
99 ms |
248 KB |
Output is correct |
2 |
Correct |
111 ms |
248 KB |
Output is correct |
3 |
Correct |
58 ms |
324 KB |
Output is correct |
4 |
Correct |
101 ms |
336 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
86 ms |
328 KB |
Output is correct |
2 |
Correct |
95 ms |
324 KB |
Output is correct |
3 |
Correct |
52 ms |
376 KB |
Output is correct |
4 |
Correct |
92 ms |
328 KB |
Output is correct |