From 106c3c9450462433aea0f04c8ad9b9c42f7d912d Mon Sep 17 00:00:00 2001 From: Not_Leonian <75620009+NotLeonian@users.noreply.github.com> Date: Sat, 11 Jul 2026 12:47:38 +0900 Subject: [PATCH 1/3] =?UTF-8?q?`default=5Fbucket=5Fsize`=20=E3=81=AE?= =?UTF-8?q?=E8=BF=94=E3=82=8A=E5=80=A4=E3=82=92=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- math/combinatorics/online-binomial-sum.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/math/combinatorics/online-binomial-sum.hpp b/math/combinatorics/online-binomial-sum.hpp index f111534..efab7df 100644 --- a/math/combinatorics/online-binomial-sum.hpp +++ b/math/combinatorics/online-binomial-sum.hpp @@ -224,7 +224,7 @@ template struct OnlineBinomialSum { assert(max_m >= 0); int bucket_size = 1; - while (4LL * bucket_size * bucket_size <= max_m) { + while (bucket_size * bucket_size <= max_m) { bucket_size *= 2; } From 7cbed25df8a68fd8ee5c6b58db8d423bd55597e4 Mon Sep 17 00:00:00 2001 From: Not_Leonian <75620009+NotLeonian@users.noreply.github.com> Date: Sat, 11 Jul 2026 12:56:30 +0900 Subject: [PATCH 2/3] =?UTF-8?q?=E3=83=89=E3=82=AD=E3=83=A5=E3=83=A1?= =?UTF-8?q?=E3=83=B3=E3=83=88=E3=81=AB=E5=A4=89=E6=9B=B4=E5=86=85=E5=AE=B9?= =?UTF-8?q?=E3=82=92=E5=8F=8D=E6=98=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/math/combinatorics/online-binomial-sum.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/math/combinatorics/online-binomial-sum.md b/docs/math/combinatorics/online-binomial-sum.md index a57cfa1..8c794b3 100644 --- a/docs/math/combinatorics/online-binomial-sum.md +++ b/docs/math/combinatorics/online-binomial-sum.md @@ -17,7 +17,7 @@ documentation_of: math/combinatorics/online-binomial-sum.hpp - $r=-1$ の場合は $\displaystyle F(n,m)=(-1)^{n-1}\binom{m-1}{n-1}$ を用い、 $r+1$ による除算を行わない。ただし、 $n=0$ または $m=0$ の場合は別に処理する。 - $r$ が $0$ でも $-1$ でもない場合、 $n$ 方向の遷移には境界項 $\displaystyle r^n\binom{m}{n}$ を用いる。 $m$ 方向の遷移にはパスカルの三角形の等式から得られる $\displaystyle F(n,m+1)=(r+1)F(n,m)-r^n\binom{m}{n-1}$ を用いる。 - バケットサイズ $B$ を指定しない場合、 $r=0$ であれば $B=1$ とし、既定のバケットサイズを計算しない。 -- バケットサイズ $B$ を指定せず、 $r\ne 0$ の場合、 $M$ が正であれば $B^2\le M$ を満たす最大の $2$ の冪が選ばれる。 $M=0$ の場合は $B=1$ である。 +- バケットサイズ $B$ を指定せず、 $r\ne 0$ の場合、 $B^2>M$ を満たす最小の $2$ の冪が選ばれる。 ## 使い方 @@ -36,7 +36,7 @@ documentation_of: math/combinatorics/online-binomial-sum.hpp - $0\le m\le M$ のクエリに対する前計算を行う。 - `r` は重みであり、省略時は $1$ である。 - $r=0$ の場合、バケットサイズ $B$ は $1$ であり、既定のバケットサイズを計算しない。 - - $r\ne 0$ の場合、バケットサイズ $B$ は、 $M$ が正であれば $B^2\le M$ を満たす最大の $2$ の冪が選ばれる。 $M=0$ の場合は $B=1$ である。 + - $r\ne 0$ の場合、バケットサイズ $B$ は、 $B^2>M$ を満たす最小の $2$ の冪が選ばれる。 - 前提: $M\ge 0$ 。 - 前提: `T` は素数 $p$ を法とする体の型であり、整数からの構築、四則演算、等値比較を持つ。 - 前提: `std::numeric_limits::is_integer` は `false` である。 From 25854535f72011714f12616cd45488140aab374f Mon Sep 17 00:00:00 2001 From: Not_Leonian <75620009+NotLeonian@users.noreply.github.com> Date: Sat, 11 Jul 2026 13:05:31 +0900 Subject: [PATCH 3/3] =?UTF-8?q?=E3=82=AD=E3=83=A3=E3=82=B9=E3=83=88?= =?UTF-8?q?=E3=81=97=E5=BF=98=E3=82=8C=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- math/combinatorics/online-binomial-sum.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/math/combinatorics/online-binomial-sum.hpp b/math/combinatorics/online-binomial-sum.hpp index efab7df..0792ea7 100644 --- a/math/combinatorics/online-binomial-sum.hpp +++ b/math/combinatorics/online-binomial-sum.hpp @@ -224,7 +224,7 @@ template struct OnlineBinomialSum { assert(max_m >= 0); int bucket_size = 1; - while (bucket_size * bucket_size <= max_m) { + while (static_cast(bucket_size) * bucket_size <= max_m) { bucket_size *= 2; }