Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit97dc6d9

Browse files
committed
upper bound on iota view
1 parent7596d34 commit97dc6d9

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

‎cp-algo/math/combinatorics.hpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
#ifndef CP_ALGO_MATH_COMBINATORICS_HPP
22
#defineCP_ALGO_MATH_COMBINATORICS_HPP
3-
#include"common.hpp"
3+
#include"../math/common.hpp"
44
#include<cassert>
5+
#include<ranges>
56
namespacecp_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(autoconst& 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
Tsmall_inv(auto n) {
69-
staticauto F =builk_invs<T>(std::views::iota(1) |std::views::take(maxn));
70+
staticauto F =bulk_invs<T>(std::views::iota(1,maxn));
7071
return F[n -1];
7172
}
7273
template<typename T>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp