test/cpv/library-checker-tree/lca.hld.cpp
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // competitive-verifier: PROBLEM https://judge.yosupo.jp/problem/lca | ||
| 2 | #include "../../../src/graph/ds/alist/lib.hpp" | ||
| 3 | #include "../../../src/io/fastin/lib.hpp" | ||
| 4 | #include "../../../src/io/fastout/lib.hpp" | ||
| 5 | #include "../../../src/tree/ds/lib.hpp" | ||
| 6 | #include "../../../src/tree/lca_hld/lib.hpp" | ||
| 7 | |||
| 8 | using namespace tifa_libs; | ||
| 9 | 25 | int main() { | |
| 10 | u32 n, q; | ||
| 11 | 25 | fin_uint >> n >> q; | |
| 12 | 25 | tree<alist<>> t(n); | |
| 13 |
2/2✓ Branch 3 taken 10224902 times.
✓ Branch 4 taken 25 times.
|
10224927 | for (u32 i = 1, x; i < n; ++i) fin_uint >> x, t.add_arc(i, x), t.add_arc(x, i); |
| 14 |
1/2✓ Branch 1 taken 25 times.
✗ Branch 2 not taken.
|
25 | lca_hld lca(t); |
| 15 |
2/2✓ Branch 0 taken 9662271 times.
✓ Branch 1 taken 25 times.
|
9662296 | for (u32 i = 0, u, v; i < q; ++i) { |
| 16 | 9662271 | fin_uint >> u >> v; | |
| 17 | 9662271 | fout << lca(u, v) << '\n'; | |
| 18 | } | ||
| 19 | 25 | return 0; | |
| 20 | 25 | } | |
| 21 |