test/cpv/library-checker-graph/counting_spanning_tree_directed.mints-ms.cpp
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #define AUTO_GENERATED | ||
| 2 | // competitive-verifier: PROBLEM https://judge.yosupo.jp/problem/counting_spanning_tree_directed | ||
| 3 | #include "../../../src/fast/rsort32/lib.hpp" | ||
| 4 | #include "../../../src/graph/ds/alist/lib.hpp" | ||
| 5 | #include "../../../src/graph/ds/amat/lib.hpp" | ||
| 6 | #include "../../../src/graph/ds/info/lib.hpp" | ||
| 7 | #include "../../../src/graph/kirchhoff/lib.hpp" | ||
| 8 | #include "../../../src/lalg/mat/ge/lib.hpp" | ||
| 9 | |||
| 10 | using namespace tifa_libs; | ||
| 11 | CEXP u32 MOD = 998244353; | ||
| 12 | |||
| 13 | #include "../../../src/math/ds/mint/ms/lib.hpp" | ||
| 14 | |||
| 15 | using namespace tifa_libs; | ||
| 16 | using mint = mint_ms<MOD>; | ||
| 17 | |||
| 18 | 22 | int main() { | |
| 19 |
1/2✓ Branch 2 taken 22 times.
✗ Branch 3 not taken.
|
22 | std::cin.tie(nullptr)->std::ios::sync_with_stdio(false); |
| 20 | u32 n, m, r; | ||
| 21 |
3/6✓ Branch 1 taken 22 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 22 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 22 times.
✗ Branch 8 not taken.
|
22 | std::cin >> n >> m >> r; |
| 22 | 22 | tifa_libs::alist<void, degin_tag, degout_tag> g(n); | |
| 23 |
2/2✓ Branch 0 taken 2831193 times.
✓ Branch 1 taken 22 times.
|
2831215 | for (u32 i = 0, u, v; i < m; ++i) { |
| 24 |
2/4✓ Branch 1 taken 2831193 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2831193 times.
✗ Branch 5 not taken.
|
2831193 | std::cin >> u >> v; |
| 25 | 2831193 | g.add_arc(u, v); | |
| 26 | } | ||
| 27 | 22 | tifa_libs::amat<mint> mat(n); | |
| 28 |
2/2✓ Branch 0 taken 2220 times.
✓ Branch 1 taken 22 times.
|
2242 | flt_ (u32, id, 0, n) { |
| 29 | 2220 | auto& tos = g[id]; | |
| 30 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 2 taken 2214 times.
|
2220 | if (tos.empty()) continue; |
| 31 | 2214 | tifa_libs::sort(tos); | |
| 32 | 2214 | u32 cnt = 1, pre = tos[0]; | |
| 33 |
2/2✓ Branch 1 taken 2828979 times.
✓ Branch 2 taken 2214 times.
|
2831193 | flt_ (u32, j, 1, (u32)tos.size()) |
| 34 |
2/2✓ Branch 2 taken 745051 times.
✓ Branch 3 taken 2083928 times.
|
2828979 | if (tos[j] != pre) { |
| 35 | 745051 | mat.add_arc(id, pre, cnt), pre = tos[j], cnt = 1; | |
| 36 | 2083928 | } else ++cnt; | |
| 37 | 2214 | mat.add_arc(id, pre, cnt); | |
| 38 | } | ||
| 39 | 1760154 | auto is_0 = [](cT_(mint) x) { return x.val() == 0; }; | |
| 40 | 19 | auto ge = [&](tifa_libs::matrix<mint>& A, bool clear_u) { return tifa_libs::ge_mat<mint, decltype(is_0), true>(A, is_0, clear_u); }; | |
| 41 |
2/4✓ Branch 1 taken 22 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 22 times.
✗ Branch 6 not taken.
|
22 | std::cout << tifa_libs::kirchhoff<true>(mat, r, ge) << '\n'; |
| 42 | 22 | return 0; | |
| 43 | 22 | } | |
| 44 |