From 75b010b347d57475acf2d064c429afac63aa36e5 Mon Sep 17 00:00:00 2001 From: darrenhp Date: Sun, 5 Apr 2026 22:37:37 +0800 Subject: [PATCH] Update mos_algorithm.hpp fix the RE https://atcoder.jp/contests/awc0040/submissions/74718807 --- other_algorithms/mos_algorithm.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/other_algorithms/mos_algorithm.hpp b/other_algorithms/mos_algorithm.hpp index a41706ea..694bc570 100644 --- a/other_algorithms/mos_algorithm.hpp +++ b/other_algorithms/mos_algorithm.hpp @@ -30,7 +30,7 @@ class MosAlgorithm { const int Q = ranges.size(); if (!Q) return; const int nbbucket = std::max(1, std::min(nmax - nmin, sqrt(Q))); - const int szbucket = (nmax - nmin + nbbucket - 1) / nbbucket; + const int szbucket = std::max(1, (nmax - nmin + nbbucket - 1) / nbbucket); std::vector qs(Q); std::iota(qs.begin(), qs.end(), 0); std::sort(qs.begin(), qs.end(), [&](int q1, int q2) {