#include <bits/stdc++.h>
#include "popa.h"
using namespace std;
int attach(int root, int ver, int *left, int *right)
{
if (root == -1)
{
left[ver] = -1;
right[ver] = -1;
return ver;
}
if (query(root, ver, ver, ver))
{
left[ver] = root;
right[ver] = -1;
return ver;
}
right[root] = attach(right[root], ver, left, right);
return root;
}
int solve(int n, int *left, int *right)
{
left[0] = right[0] = -1;
int root = 0;
for (int i = 1; i < n; i++)
root = attach(root, i, left, right);
return root;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
33 ms |
364 KB |
Output is correct |
2 |
Correct |
98 ms |
364 KB |
Output is correct |
3 |
Correct |
18 ms |
364 KB |
Output is correct |
4 |
Correct |
44 ms |
364 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
331 ms |
508 KB |
too many queries |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
24 ms |
364 KB |
too many queries |
2 |
Halted |
0 ms |
0 KB |
- |