test/cpv/library-checker-number_theory/sum_of_totient_function.du-ls2.mintd-bd.cpp
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #define AUTO_GENERATED | ||
| 2 | // competitive-verifier: PROBLEM https://judge.yosupo.jp/problem/sum_of_totient_function | ||
| 3 | #include "../../../src/math/iroot/sqrt/lib.hpp" | ||
| 4 | #include "../../../src/nt/lsieve/impl2/lib.hpp" | ||
| 5 | #include "../../../src/nt/mfsum/du/lib.hpp" | ||
| 6 | |||
| 7 | using namespace tifa_libs; | ||
| 8 | CEXP u32 MOD = 998244353; | ||
| 9 | |||
| 10 | #include "../../../src/math/ds/mint/bd/lib.hpp" | ||
| 11 | |||
| 12 | using namespace tifa_libs; | ||
| 13 | using mint = mint_bd<__LINE__>; | ||
| 14 | |||
| 15 | 48 | int main() { | |
| 16 | 48 | mint::set_mod(MOD); | |
| 17 |
1/2✓ Branch 2 taken 48 times.
✗ Branch 3 not taken.
|
48 | std::cin.tie(nullptr)->std::ios::sync_with_stdio(false); |
| 18 | u64 n; | ||
| 19 |
1/2✓ Branch 1 taken 48 times.
✗ Branch 2 not taken.
|
48 | std::cin >> n; |
| 20 | 48 | vec<mint> sphi; | |
| 21 | { | ||
| 22 | 48 | mint lst = 1; | |
| 23 | 96 | sphi = tifa_libs::lsieve2(tifa_libs::isqrt(n)).template run<mint>([&lst](u32 p, u32 e) { | |
| 24 |
2/2✓ Branch 0 taken 302368 times.
✓ Branch 1 taken 3935 times.
|
306303 | if (e == 1) return lst = p - 1; |
| 25 | 3935 | else return lst = lst * p; | |
| 26 | 48 | }); | |
| 27 |
1/2✓ Branch 4 taken 48 times.
✗ Branch 5 not taken.
|
48 | std::inclusive_scan(begin(sphi), end(sphi), begin(sphi)); |
| 28 | } | ||
| 29 |
1/2✓ Branch 1 taken 48 times.
✗ Branch 2 not taken.
|
3477527402 | auto sf = [sphi](u64 x) -> mint { return sphi[x]; }; |
| 30 | 7022594001 | auto sg = [](u64 x) -> mint { return x; }; | |
| 31 | 3084571 | auto sh = [](u64 x) -> mint { return mint{x} * (x + 1) * ((mint::mod() + 1) / 2); }; | |
| 32 |
2/4✓ Branch 1 taken 48 times.
✗ Branch 2 not taken.
✓ Branch 8 taken 48 times.
✗ Branch 9 not taken.
|
48 | std::cout << tifa_libs::du_sieve<mint, decltype(sf), decltype(sg), decltype(sh)>(sphi.size() - 1, sf, sg, sh)(n) << '\n'; |
| 33 | 48 | return 0; | |
| 34 | 48 | } | |
| 35 |