From 3ea364020925aabaf465f4d4baab03f076047735 Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Fri, 2 Dec 2022 16:40:22 +0800 Subject: [PATCH] =?UTF-8?q?P3803=20=E3=80=90=E6=A8=A1=E6=9D=BF=E3=80=91?= =?UTF-8?q?=E5=A4=9A=E9=A1=B9=E5=BC=8F=E4=B9=98=E6=B3=95=EF=BC=88FFT?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://www.luogu.com.cn/record/96299698 --- Luogu/P3803/P3803.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Luogu/P3803/P3803.cpp b/Luogu/P3803/P3803.cpp index 20c88a28..487f5dec 100644 --- a/Luogu/P3803/P3803.cpp +++ b/Luogu/P3803/P3803.cpp @@ -22,7 +22,9 @@ constexpr long long binpow(long long a, long long b) { return res; } -std::vector number_theoretic_transform(std::vector a) { +void number_theoretic_transform(std::vector &a) { + if (a.size() == 1) return; + // assert(a.size() == (1 << std::__lg(a.size()))); int k = std::__lg(a.size()); @@ -55,8 +57,6 @@ std::vector number_theoretic_transform(std::vector a) { } } } - - return a; } class Poly : public std::vector { @@ -81,15 +81,15 @@ class Poly : public std::vector { std::vector f(*this), g(b); f.resize(k); - f = number_theoretic_transform(f); + number_theoretic_transform(f); g.resize(k); - g = number_theoretic_transform(g); + number_theoretic_transform(g); for (int i = 0; i < k; i++) { f[i] = f[i] * g[i] % mod; } - f = number_theoretic_transform(f); + number_theoretic_transform(f); // assert(f.size() > 0) std::reverse(f.begin() + 1, f.end());