test/cpv/library-checker-tree/tree_diameter.cpp
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // competitive-verifier: PROBLEM https://judge.yosupo.jp/problem/tree_diameter | ||
| 2 | #include "../../../src/graph/ds/alist/lib.hpp" | ||
| 3 | #include "../../../src/graph/path/lib.hpp" | ||
| 4 | #include "../../../src/io/container/lib.hpp" | ||
| 5 | #include "../../../src/tree/dfs/diam/lib.hpp" | ||
| 6 | #include "../../../src/tree/ds/lib.hpp" | ||
| 7 | |||
| 8 | using namespace tifa_libs; | ||
| 9 | 16 | int main() { | |
| 10 |
1/2✓ Branch 2 taken 16 times.
✗ Branch 3 not taken.
|
16 | std::cin.tie(nullptr)->std::ios::sync_with_stdio(false); |
| 11 | u32 n; | ||
| 12 |
1/2✓ Branch 1 taken 16 times.
✗ Branch 2 not taken.
|
16 | std::cin >> n; |
| 13 | 16 | alist<u64> g(n); | |
| 14 |
2/2✓ Branch 0 taken 3612748 times.
✓ Branch 1 taken 16 times.
|
3612764 | for (u32 i = 1, u, v, w; i < n; ++i) { |
| 15 |
3/6✓ Branch 1 taken 3612748 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 3612748 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 3612748 times.
✗ Branch 8 not taken.
|
3612748 | std::cin >> u >> v >> w; |
| 16 | 3612748 | g.add_arc(u, v, (u64)w), g.add_arc(v, u, (u64)w); | |
| 17 | } | ||
| 18 | 16 | tree tr(g); | |
| 19 | 16 | auto [u, v, w] = tree_diam(tr); | |
| 20 |
1/2✓ Branch 2 taken 16 times.
✗ Branch 3 not taken.
|
16 | auto p = path(g, u, v).value(); |
| 21 |
4/8✓ Branch 1 taken 16 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 16 times.
✗ Branch 5 not taken.
✓ Branch 8 taken 16 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 16 times.
✗ Branch 12 not taken.
|
16 | std::cout << w << ' ' << p.size() << '\n'; |
| 22 |
1/2✓ Branch 2 taken 16 times.
✗ Branch 3 not taken.
|
16 | std::cout << p << '\n'; |
| 23 | 16 | return 0; | |
| 24 | 16 | } | |
| 25 |