test/cpv/library-checker-enumerative_combinatorics/q_binomial_coefficient_prime_mod.mintd-bd.mints-ms64.poly_anymod-p3ntt.factorial-factl_helper.cpp
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #define AUTO_GENERATED | ||
| 2 | // competitive-verifier: PROBLEM https://judge.yosupo.jp/problem/q_binomial_coefficient_prime_mod | ||
| 3 | #include "../../../src/comb/qbinom/lib.hpp" | ||
| 4 | #include "../../../src/io/fastin/lib.hpp" | ||
| 5 | #include "../../../src/io/fastout/lib.hpp" | ||
| 6 | |||
| 7 | using namespace tifa_libs; | ||
| 8 | CEXP u32 MOD = 998244353; | ||
| 9 | |||
| 10 | #include "../../../src/fps/ds/ntt3/lib.hpp" | ||
| 11 | #include "../../../src/math/ds/mint/bd/lib.hpp" | ||
| 12 | #include "../../../src/math/ds/mint/ms64/lib.hpp" | ||
| 13 | #include "../../../src/math/fact/helper_l/lib.hpp" | ||
| 14 | |||
| 15 | using namespace tifa_libs; | ||
| 16 | using mint = mint_bd<__LINE__>; | ||
| 17 | using namespace tifa_libs; | ||
| 18 | using mint_p3ntt1 = mint_ms64<167772161>; | ||
| 19 | using mint_p3ntt2 = mint_ms64<469762049>; | ||
| 20 | using mint_p3ntt3 = mint_ms64<754974721>; | ||
| 21 | using poly = poly3ntt<mint, mint_p3ntt1, mint_p3ntt2, mint_p3ntt3>; | ||
| 22 | using namespace tifa_libs; | ||
| 23 | using fact_t = factl_helper<poly>; | ||
| 24 | |||
| 25 | 30 | int main() { | |
| 26 | 30 | mint::set_mod(MOD); | |
| 27 | u32 t, mod, q; | ||
| 28 | 30 | tifa_libs::fin_uint >> t >> mod >> q; | |
| 29 | 30 | mint::set_mod(mod); | |
| 30 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 26 times.
|
30 | if (!q) { |
| 31 |
2/2✓ Branch 0 taken 3000007 times.
✓ Branch 1 taken 4 times.
|
3000011 | while (t--) { |
| 32 | i64 n, k; | ||
| 33 | 3000007 | tifa_libs::fin_uint >> n >> k; | |
| 34 |
3/4✓ Branch 0 taken 1916418 times.
✓ Branch 1 taken 1083589 times.
✓ Branch 2 taken 1916418 times.
✗ Branch 3 not taken.
|
3000007 | tifa_libs::fout << !(n < k || k < 0) << '\n'; |
| 35 | } | ||
| 36 | 4 | return 0; | |
| 37 | } | ||
| 38 | 26 | tifa_libs::qbinom<mint, fact_t> mCn(q); | |
| 39 |
2/2✓ Branch 0 taken 24000014 times.
✓ Branch 1 taken 26 times.
|
24000040 | while (t--) { |
| 40 | i64 n, k; | ||
| 41 | 24000014 | tifa_libs::fin_uint >> n >> k; | |
| 42 | 24000014 | tifa_libs::fout << mCn.qmCn(n, k) << '\n'; | |
| 43 | } | ||
| 44 | |||
| 45 | 26 | return 0; | |
| 46 | 26 | } | |
| 47 |