File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change 11#ifndef CP_ALGO_MATH_COMBINATORICS_HPP
22#define CP_ALGO_MATH_COMBINATORICS_HPP
3- #include " common.hpp"
3+ #include " ../math/ common.hpp"
44#include < cassert>
5+ #include < ranges>
56namespace cp_algo ::math {
67 // fact/rfact/small_inv are caching
78 // Beware of usage with dynamic mod
@@ -52,12 +53,12 @@ namespace cp_algo::math {
5253 }
5354 template <typename T>
5455 std::vector<T> bulk_invs (auto const & args) {
55- std::vector<T> res (size (args), args[0 ]);
56- for (size_t i = 1 ; i < size (args); i++) {
56+ std::vector<T> res (std:: size (args), args[0 ]);
57+ for (size_t i = 1 ; i < std:: size (args); i++) {
5758 res[i] = res[i - 1 ] * args[i];
5859 }
5960 auto all_invs = T (1 ) / res.back ();
60- for (size_t i = size (args) - 1 ; i > 0 ; i--) {
61+ for (size_t i = std:: size (args) - 1 ; i > 0 ; i--) {
6162 res[i] = all_invs * res[i - 1 ];
6263 all_invs *= args[i];
6364 }
@@ -66,7 +67,7 @@ namespace cp_algo::math {
6667 }
6768 template <typename T>
6869 T small_inv (auto n) {
69- static auto F = builk_invs <T>(std::views::iota (1 ) | std::views::take ( maxn));
70+ static auto F = bulk_invs <T>(std::views::iota (1 , maxn));
7071 return F[n - 1 ];
7172 }
7273 template <typename T>
You can’t perform that action at this time.
0 commit comments