From 1a2deb43e118ef8af54ce9a1c43a44f03f593341 Mon Sep 17 00:00:00 2001 From: maspypy Date: Sat, 23 Nov 2024 02:19:27 +0900 Subject: [PATCH 1/2] add test --- polynomial/multipoint_evaluation/gen/issue_1287_00.in | 3 +++ polynomial/multipoint_evaluation/hash.json | 2 ++ polynomial/multipoint_evaluation/info.toml | 3 +++ 3 files changed, 8 insertions(+) create mode 100644 polynomial/multipoint_evaluation/gen/issue_1287_00.in diff --git a/polynomial/multipoint_evaluation/gen/issue_1287_00.in b/polynomial/multipoint_evaluation/gen/issue_1287_00.in new file mode 100644 index 000000000..764359cfe --- /dev/null +++ b/polynomial/multipoint_evaluation/gen/issue_1287_00.in @@ -0,0 +1,3 @@ +4 4 +0 0 0 1 +1 2 0 3 diff --git a/polynomial/multipoint_evaluation/hash.json b/polynomial/multipoint_evaluation/hash.json index b40268d97..21a03bbe0 100644 --- a/polynomial/multipoint_evaluation/hash.json +++ b/polynomial/multipoint_evaluation/hash.json @@ -3,6 +3,8 @@ "example_00.out": "89bee91478eb45ef73901bfdbc28bbaa8468c003dc480f8881b3222f9bc7e956", "example_01.in": "cb82ca85c390fabfd1c38aa4d97d76071db8fb8ba0e70ba6179f525564e40cd1", "example_01.out": "de6aeb89b0d91519a443ac503ea9e652f130752e5ecc78cbcffc3e0f04e4bbf0", + "issue_1287_00.in": "24c5293f33bf38ab1c1d64f239a1736c69ab507d9d693c7abb43053107cc632c", + "issue_1287_00.out": "4e440e0688fe50b33a612be918cb0128462a2bea7b4f1972c89c49a04d3015e4", "max_random_00.in": "bd75a638e1008099cf0a1366a652c8584e18f3c096473bdb8a464142673ee6ae", "max_random_00.out": "de294de44c13cbc69e3d40c78af307493a90ee539d0acc5ed8b70946fb0c211f", "max_random_01.in": "663c77c8cf1375ccc8a4d1ed95ce1bf91c988bb6ea517fcbc8b34852f2b963ee", diff --git a/polynomial/multipoint_evaluation/info.toml b/polynomial/multipoint_evaluation/info.toml index 348179951..b97b7d976 100644 --- a/polynomial/multipoint_evaluation/info.toml +++ b/polynomial/multipoint_evaluation/info.toml @@ -14,4 +14,7 @@ forum = "https://github.com/yosupo06/library-checker-problems/issues/45" [[tests]] name = "zero.in" number = 1 +[[tests]] + name = "issue_1287.in" + number = 1 From 832a34984abf4dbd796948889b9c72d5980aec4d Mon Sep 17 00:00:00 2001 From: maspypy Date: Thu, 2 Jan 2025 19:27:28 +0900 Subject: [PATCH 2/2] add test --- .../gen/issue_1287_cpp.cpp | 45 +++++++++++++++++++ polynomial/multipoint_evaluation/hash.json | 4 ++ polynomial/multipoint_evaluation/info.toml | 3 ++ 3 files changed, 52 insertions(+) create mode 100644 polynomial/multipoint_evaluation/gen/issue_1287_cpp.cpp diff --git a/polynomial/multipoint_evaluation/gen/issue_1287_cpp.cpp b/polynomial/multipoint_evaluation/gen/issue_1287_cpp.cpp new file mode 100644 index 000000000..cc23ec9da --- /dev/null +++ b/polynomial/multipoint_evaluation/gen/issue_1287_cpp.cpp @@ -0,0 +1,45 @@ +#include +#include "random.h" + +using namespace std; + +int main(int, char* argv[]) { + long long seed = atoll(argv[1]); + auto gen = Random(seed); + + int zero = 20; + int n = (1 << 17) - zero; + int m = (1 << 17); + vector a(n + zero), b(m); + + for (int i = 0; i < n; i++) { a[i] = gen.uniform((i != n - 1) ? 0 : 1, 998244352); } + for (int i = 0; i < m; i++) { b[i] = gen.uniform(0, 998244352); } + + const int MOD = 998244353; + for (int i = 0; i < zero; i++) { + int v = gen.uniform(0, 998244353); + if (i < 10) + b[gen.uniform(0, m)] = (MOD - v) % MOD; + else + b[i] = (MOD - v) % MOD; + for (int j = n - 1; j >= 0; j--) { + a[j + 1] = (a[j + 1] + a[j]) % MOD; + a[j] = (long long)(a[j]) * (long long)(v) % MOD; + } + n++; + } + + printf("%d %d\n", n, m); + + for (int i = 0; i < n; i++) { + printf("%d", a[i]); + if (i != n - 1) printf(" "); + } + printf("\n"); + for (int i = 0; i < m; i++) { + printf("%d", b[i]); + if (i != m - 1) printf(" "); + } + printf("\n"); + return 0; +} \ No newline at end of file diff --git a/polynomial/multipoint_evaluation/hash.json b/polynomial/multipoint_evaluation/hash.json index 21a03bbe0..5ccc86c1a 100644 --- a/polynomial/multipoint_evaluation/hash.json +++ b/polynomial/multipoint_evaluation/hash.json @@ -5,6 +5,10 @@ "example_01.out": "de6aeb89b0d91519a443ac503ea9e652f130752e5ecc78cbcffc3e0f04e4bbf0", "issue_1287_00.in": "24c5293f33bf38ab1c1d64f239a1736c69ab507d9d693c7abb43053107cc632c", "issue_1287_00.out": "4e440e0688fe50b33a612be918cb0128462a2bea7b4f1972c89c49a04d3015e4", + "issue_1287_cpp_00.in": "7551d684fed0a3bb2b524ce5da628be67b83d0265a4cb3bfd8e92de5ea66d32a", + "issue_1287_cpp_00.out": "3f0ca4137cda8b0ba02f5b1c3abeea996fe3932a27ca6044a42ab66991c49b33", + "issue_1287_cpp_01.in": "baf531c8562b0b39f9a1bc9e513e1a8acbaa04da283449abeb7f2269cb5b4759", + "issue_1287_cpp_01.out": "b689a41bf8113edc0911bad9f798001fe4173b7f96033ff31c0ac3378e5bab4a", "max_random_00.in": "bd75a638e1008099cf0a1366a652c8584e18f3c096473bdb8a464142673ee6ae", "max_random_00.out": "de294de44c13cbc69e3d40c78af307493a90ee539d0acc5ed8b70946fb0c211f", "max_random_01.in": "663c77c8cf1375ccc8a4d1ed95ce1bf91c988bb6ea517fcbc8b34852f2b963ee", diff --git a/polynomial/multipoint_evaluation/info.toml b/polynomial/multipoint_evaluation/info.toml index b97b7d976..7b72c8b62 100644 --- a/polynomial/multipoint_evaluation/info.toml +++ b/polynomial/multipoint_evaluation/info.toml @@ -17,4 +17,7 @@ forum = "https://github.com/yosupo06/library-checker-problems/issues/45" [[tests]] name = "issue_1287.in" number = 1 +[[tests]] + name = "issue_1287_cpp.cpp" + number = 2