test/cpv/library-checker-graph/cycle_detection.hash-splitmix64.hashmap-pbds_gp_hmap.cpp
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #define AUTO_GENERATED | ||
| 2 | // competitive-verifier: PROBLEM https://judge.yosupo.jp/problem/cycle_detection | ||
| 3 | #include "../../../src/graph/ds/alist/lib.hpp" | ||
| 4 | #include "../../../src/graph/find_cycle/lib.hpp" | ||
| 5 | // | ||
| 6 | #include "../../../src/edh/splitmix64/lib.hpp" | ||
| 7 | |||
| 8 | using namespace tifa_libs; | ||
| 9 | template <class> | ||
| 10 | using hashfunc_t = hash_splitmix64; | ||
| 11 | using namespace tifa_libs; | ||
| 12 | template <class K, class V> | ||
| 13 | using hashmap = __gnu_pbds::gp_hash_table<K, V, std::conditional_t<std::is_void_v<hashfunc_t<K>>, TPN __gnu_pbds::detail::default_hash_fn<K>::type, hashfunc_t<K>>>; | ||
| 14 | |||
| 15 | 35 | int main() { | |
| 16 |
1/2✓ Branch 2 taken 35 times.
✗ Branch 3 not taken.
|
35 | std::cin.tie(nullptr)->std::ios::sync_with_stdio(false); |
| 17 | u32 n, m; | ||
| 18 |
2/4✓ Branch 1 taken 35 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 35 times.
✗ Branch 5 not taken.
|
35 | std::cin >> n >> m; |
| 19 | 35 | tifa_libs::alist g(n); | |
| 20 |
1/2✓ Branch 1 taken 35 times.
✗ Branch 2 not taken.
|
35 | hashmap<pttu, u32> edges; |
| 21 |
2/2✓ Branch 0 taken 10427096 times.
✓ Branch 1 taken 35 times.
|
10427131 | for (u32 i = 0, u, v; i < m; ++i) { |
| 22 |
2/4✓ Branch 1 taken 10427096 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 10427096 times.
✗ Branch 5 not taken.
|
10427096 | std::cin >> u >> v; |
| 23 |
1/2✓ Branch 2 taken 10427096 times.
✗ Branch 3 not taken.
|
10427096 | edges[{u, v}] = i; |
| 24 | 10427096 | g.add_arc(u, v); | |
| 25 | } | ||
| 26 | 35 | auto res = tifa_libs::find_cycle<true>(g); | |
| 27 |
2/2✓ Branch 1 taken 20 times.
✓ Branch 2 taken 15 times.
|
35 | if (res.empty()) { |
| 28 |
1/2✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
|
20 | std::cout << "-1\n"; |
| 29 | 20 | return 0; | |
| 30 | } | ||
| 31 |
2/4✓ Branch 2 taken 15 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 15 times.
✗ Branch 6 not taken.
|
15 | std::cout << res.size() << '\n'; |
| 32 |
5/8✓ Branch 4 taken 160148 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 160148 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 160148 times.
✗ Branch 11 not taken.
✓ Branch 14 taken 160148 times.
✓ Branch 15 taken 15 times.
|
160163 | for (auto&& i : res) std::cout << edges[i] << '\n'; |
| 33 | 15 | return 0; | |
| 34 | 35 | } | |
| 35 |