Skip to content

Commit f716b2f

Browse files
authored
[auto-verifier] docs commit ac1a6e0
1 parent 291efbe commit f716b2f

38 files changed

+2130
-752
lines changed

index.md

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
---
22
data:
33
libraryCategories:
4+
- name: weilycoder
5+
pages:
6+
- icon: ':heavy_check_mark:'
7+
path: weilycoder/const_rand.hpp
8+
title: Linear Congruential Generator (LCG) to produce pseudo-random numbers
9+
- icon: ':heavy_check_mark:'
10+
path: weilycoder/fast-io.hpp
11+
title: Fast Input/Output Utilities
412
- name: weilycoder/ds
513
pages:
614
- icon: ':heavy_check_mark:'
@@ -21,11 +29,6 @@ data:
2129
- icon: ':heavy_check_mark:'
2230
path: weilycoder/ds/unionfind.hpp
2331
title: Union-Find (Disjoint Set Union) Data Structure
24-
- name: weilycoder
25-
pages:
26-
- icon: ':heavy_check_mark:'
27-
path: weilycoder/fast-io.hpp
28-
title: Fast Input/Output Utilities
2932
- name: weilycoder/graph
3033
pages:
3134
- icon: ':heavy_check_mark:'
@@ -59,6 +62,12 @@ data:
5962
- icon: ':heavy_check_mark:'
6063
path: weilycoder/poly/karatsuba.hpp
6164
title: Multiply two polynomials using the Karatsuba algorithm.
65+
- icon: ':heavy_check_mark:'
66+
path: weilycoder/poly/ntt.hpp
67+
title: Number Theoretic Transform (NTT)
68+
- icon: ':heavy_check_mark:'
69+
path: weilycoder/poly/ntt_convolve.hpp
70+
title: weilycoder/poly/ntt_convolve.hpp
6271
verificationCategories:
6372
- name: test
6473
pages:
@@ -68,6 +77,9 @@ data:
6877
- icon: ':heavy_check_mark:'
6978
path: test/biconnected_components.test.cpp
7079
title: test/biconnected_components.test.cpp
80+
- icon: ':heavy_check_mark:'
81+
path: test/convolution_mod.test.cpp
82+
title: test/convolution_mod.test.cpp
7183
- icon: ':heavy_check_mark:'
7284
path: test/convolution_mod_2_64.test.cpp
7385
title: test/convolution_mod_2_64.test.cpp

test/aplusb.test.cpp.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ data:
160160
isVerificationFile: true
161161
path: test/aplusb.test.cpp
162162
requiredBy: []
163-
timestamp: '2025-11-06 23:46:32+08:00'
163+
timestamp: '2025-11-07 09:14:02+08:00'
164164
verificationStatus: TEST_ACCEPTED
165165
verifiedWith: []
166166
documentation_of: test/aplusb.test.cpp

test/biconnected_components.test.cpp.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ data:
112112
isVerificationFile: true
113113
path: test/biconnected_components.test.cpp
114114
requiredBy: []
115-
timestamp: '2025-11-06 23:46:32+08:00'
115+
timestamp: '2025-11-07 09:14:02+08:00'
116116
verificationStatus: TEST_ACCEPTED
117117
verifiedWith: []
118118
documentation_of: test/biconnected_components.test.cpp

test/convolution_mod.test.cpp.md

Lines changed: 325 additions & 0 deletions
Large diffs are not rendered by default.

test/convolution_mod_2_64.test.cpp.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ data:
9595
isVerificationFile: true
9696
path: test/convolution_mod_2_64.test.cpp
9797
requiredBy: []
98-
timestamp: '2025-11-06 23:46:32+08:00'
98+
timestamp: '2025-11-07 09:14:02+08:00'
9999
verificationStatus: TEST_ACCEPTED
100100
verifiedWith: []
101101
documentation_of: test/convolution_mod_2_64.test.cpp

test/factorize.test.cpp.md

Lines changed: 128 additions & 88 deletions
Large diffs are not rendered by default.

test/many_aplusb.test.cpp.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ data:
162162
isVerificationFile: true
163163
path: test/many_aplusb.test.cpp
164164
requiredBy: []
165-
timestamp: '2025-11-06 23:46:32+08:00'
165+
timestamp: '2025-11-07 09:14:02+08:00'
166166
verificationStatus: TEST_ACCEPTED
167167
verifiedWith: []
168168
documentation_of: test/many_aplusb.test.cpp

test/many_aplusb_128bit.test.cpp.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ data:
161161
isVerificationFile: true
162162
path: test/many_aplusb_128bit.test.cpp
163163
requiredBy: []
164-
timestamp: '2025-11-06 23:46:32+08:00'
164+
timestamp: '2025-11-07 09:14:02+08:00'
165165
verificationStatus: TEST_ACCEPTED
166166
verifiedWith: []
167167
documentation_of: test/many_aplusb_128bit.test.cpp

test/multiplication_of_big_integers.fft.test.cpp.md

Lines changed: 43 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -38,51 +38,54 @@ data:
3838
\ two for use with the FFT implementation in this file.\n */\ntemplate <typename\
3939
\ T> void fft_change(std::vector<T> &a) {\n size_t n = a.size();\n std::vector<size_t>\
4040
\ rev(n);\n for (size_t i = 0; i < n; ++i) {\n rev[i] = rev[i >> 1] >> 1;\n\
41-
\ if (i & 1)\n rev[i] |= n >> 1;\n if (i < rev[i])\n swap(a[i],\
42-
\ a[rev[i]]);\n }\n}\n} // namespace weilycoder\n\n\n#line 8 \"weilycoder/poly/fft.hpp\"\
43-
\n\n/**\n * @file fft.hpp\n * @brief Implementation of Fast Fourier Transform\
44-
\ (FFT) and its inverse.\n */\n\nnamespace weilycoder {\n/**\n * @brief In-place\
45-
\ iterative Cooley\u2013Tukey FFT / inverse FFT on a complex vector.\n * \
46-
\ The length of the input vector should be a power of two.\n * @tparam on Direction\
47-
\ of the transform: 1 for FFT, -1 for inverse FFT.\n * @tparam float_t Floating-point\
48-
\ type for computations (default: double).\n * @param y Vector of complex numbers\
49-
\ to be transformed in-place.\n */\ntemplate <int32_t on = 1, typename float_t\
50-
\ = double>\nvoid fft(std::vector<std::complex<float_t>> &y) {\n static_assert(on\
51-
\ == 1 || on == -1, \"on must be 1 or -1\");\n fft_change(y);\n for (size_t\
52-
\ h = 2; h <= y.size(); h <<= 1) {\n std::complex<float_t> wn(cos(2 * PI<float_t>\
53-
\ / h), sin(on * 2 * PI<float_t> / h));\n for (size_t j = 0; j < y.size();\
54-
\ j += h) {\n std::complex<float_t> w(1, 0);\n for (size_t k = j; k\
55-
\ < j + (h >> 1); ++k, w *= wn) {\n std::complex<float_t> u = y[k], t =\
56-
\ w * y[k + (h >> 1)];\n y[k] = u + t, y[k + (h >> 1)] = u - t;\n \
57-
\ }\n }\n }\n size_t len = y.size();\n if constexpr (on == -1)\n for\
58-
\ (size_t i = 0; i < len; ++i)\n y[i] /= len;\n}\n} // namespace weilycoder\n\
59-
\n\n#line 8 \"weilycoder/poly/fft_convolve.hpp\"\n\n/**\n * @file fft_convolve.hpp\n\
60-
\ * @brief Functions for performing convolution using Fast Fourier Transform (FFT).\
61-
\ \n */\n\nnamespace weilycoder {\n/**\n * @brief Perform convolution of two\
62-
\ complex vectors using FFT.\n * @tparam float_t Floating-point type for computations\
41+
\ if (i & 1)\n rev[i] |= n >> 1;\n if (i < rev[i])\n std::swap(a[i],\
42+
\ a[rev[i]]);\n }\n}\n} // namespace weilycoder\n\n\n#line 7 \"weilycoder/poly/fft.hpp\"\
43+
\n#include <stdexcept>\n#line 9 \"weilycoder/poly/fft.hpp\"\n\n/**\n * @file fft.hpp\n\
44+
\ * @brief Implementation of Fast Fourier Transform (FFT) and its inverse.\n */\n\
45+
\nnamespace weilycoder {\n/**\n * @brief In-place iterative Cooley\u2013Tukey\
46+
\ FFT / inverse FFT on a complex vector.\n * The length of the input vector\
47+
\ should be a power of two.\n * @tparam on Direction of the transform: 1 for FFT,\
48+
\ -1 for inverse FFT.\n * @tparam float_t Floating-point type for computations\
49+
\ (default: double).\n * @param y Vector of complex numbers to be transformed\
50+
\ in-place.\n */\ntemplate <int32_t on = 1, typename float_t = double>\nvoid fft(std::vector<std::complex<float_t>>\
51+
\ &y) {\n static_assert(on == 1 || on == -1, \"on must be 1 or -1\");\n fft_change(y);\n\
52+
\ size_t len = y.size();\n if (len == 0 || (len & (len - 1)) != 0)\n throw\
53+
\ std::invalid_argument(\"Length of input vector must be a power of two\");\n\
54+
\ for (size_t h = 2; h <= len; h <<= 1) {\n std::complex<float_t> wn(cos(2\
55+
\ * PI<float_t> / h), sin(on * 2 * PI<float_t> / h));\n for (size_t j = 0;\
56+
\ j < len; j += h) {\n std::complex<float_t> w(1, 0);\n for (size_t\
57+
\ k = j; k < j + (h >> 1); ++k, w *= wn) {\n std::complex<float_t> u =\
58+
\ y[k], t = w * y[k + (h >> 1)];\n y[k] = u + t, y[k + (h >> 1)] = u -\
59+
\ t;\n }\n }\n }\n if constexpr (on == -1)\n for (size_t i = 0; i\
60+
\ < len; ++i)\n y[i] /= len;\n}\n} // namespace weilycoder\n\n\n#line 8 \"\
61+
weilycoder/poly/fft_convolve.hpp\"\n\n/**\n * @file fft_convolve.hpp\n * @brief\
62+
\ Functions for performing convolution using Fast Fourier Transform (FFT). \n\
63+
\ */\n\nnamespace weilycoder {\n/**\n * @brief Perform convolution of two complex\
64+
\ vectors using FFT.\n * @tparam float_t Floating-point type for computations\
6365
\ (default: double).\n * @param a First input vector of complex numbers.\n * @param\
6466
\ b Second input vector of complex numbers.\n * @return Vector containing the\
6567
\ convolution result.\n */\ntemplate <typename float_t = double>\nstd::vector<std::complex<float_t>>\
6668
\ fft_convolve(std::vector<std::complex<float_t>> a,\n \
6769
\ std::vector<std::complex<float_t>> b) {\n size_t n\
6870
\ = 1;\n while (n < a.size() + b.size() - 1)\n n <<= 1;\n a.resize(n), b.resize(n);\n\
69-
\ fft(a), fft(b);\n for (size_t i = 0; i < n; ++i)\n a[i] *= b[i];\n return\
70-
\ fft<-1>(a), a;\n}\n\n/**\n * @brief Perform convolution of two real-valued vectors\
71-
\ using FFT.\n * @tparam float_t Floating-point type for computations (default:\
72-
\ double).\n * @param a First input vector of real numbers.\n * @param b Second\
73-
\ input vector of real numbers.\n * @return Vector containing the convolution\
74-
\ result.\n * @note This function uses a technique that combines two real sequences\
75-
\ into\n * a single complex sequence to perform the convolution more efficiently.\n\
76-
\ */\ntemplate <typename float_t = double>\nstd::vector<float_t> fft_convolve_real(const\
77-
\ std::vector<float_t> &a,\n const std::vector<float_t>\
78-
\ &b) {\n size_t n = 1;\n while (n < a.size() + b.size() - 1)\n n <<= 1;\n\
79-
\ std::vector<std::complex<float_t>> F(n);\n for (size_t i = 0; i < a.size();\
80-
\ ++i)\n F[i].real(a[i]);\n for (size_t i = 0; i < b.size(); ++i)\n F[i].imag(b[i]);\n\
81-
\ fft(F);\n for (size_t i = 0; i < n; ++i)\n F[i] *= F[i];\n fft<-1>(F);\n\
82-
\ std::vector<float_t> result(a.size() + b.size() - 1);\n for (size_t i = 0;\
83-
\ i < result.size(); ++i)\n result[i] = F[i].imag() / 2;\n return result;\n\
84-
}\n} // namespace weilycoder\n\n\n#line 4 \"test/multiplication_of_big_integers.fft.test.cpp\"\
85-
\n#include <algorithm>\n#include <iostream>\n#include <string>\n#line 8 \"test/multiplication_of_big_integers.fft.test.cpp\"\
71+
\ fft(a), fft(b);\n for (size_t i = 0; i < n; ++i)\n a[i] *= b[i];\n fft<-1>(a),\
72+
\ a.resize(a.size() + b.size() - 1);\n return a;\n}\n\n/**\n * @brief Perform\
73+
\ convolution of two real-valued vectors using FFT.\n * @tparam float_t Floating-point\
74+
\ type for computations (default: double).\n * @param a First input vector of\
75+
\ real numbers.\n * @param b Second input vector of real numbers.\n * @return\
76+
\ Vector containing the convolution result.\n * @note This function uses a technique\
77+
\ that combines two real sequences into\n * a single complex sequence to\
78+
\ perform the convolution more efficiently.\n */\ntemplate <typename float_t =\
79+
\ double>\nstd::vector<float_t> fft_convolve_real(const std::vector<float_t> &a,\n\
80+
\ const std::vector<float_t> &b) {\n size_t\
81+
\ n = 1;\n while (n < a.size() + b.size() - 1)\n n <<= 1;\n std::vector<std::complex<float_t>>\
82+
\ F(n);\n for (size_t i = 0; i < a.size(); ++i)\n F[i].real(a[i]);\n for\
83+
\ (size_t i = 0; i < b.size(); ++i)\n F[i].imag(b[i]);\n fft(F);\n for (size_t\
84+
\ i = 0; i < n; ++i)\n F[i] *= F[i];\n fft<-1>(F);\n std::vector<float_t>\
85+
\ result(a.size() + b.size() - 1);\n for (size_t i = 0; i < result.size(); ++i)\n\
86+
\ result[i] = F[i].imag() / 2;\n return result;\n}\n} // namespace weilycoder\n\
87+
\n\n#line 4 \"test/multiplication_of_big_integers.fft.test.cpp\"\n#include <algorithm>\n\
88+
#include <iostream>\n#include <string>\n#line 8 \"test/multiplication_of_big_integers.fft.test.cpp\"\
8689
\nusing namespace std;\nusing namespace weilycoder;\n\nstatic void solve() {\n\
8790
\ string a, b;\n cin >> a >> b;\n\n reverse(a.begin(), a.end()), reverse(b.begin(),\
8891
\ b.end());\n\n bool negative = false;\n if (a.back() == '-')\n negative\
@@ -124,7 +127,7 @@ data:
124127
isVerificationFile: true
125128
path: test/multiplication_of_big_integers.fft.test.cpp
126129
requiredBy: []
127-
timestamp: '2025-11-06 23:46:32+08:00'
130+
timestamp: '2025-11-07 09:14:02+08:00'
128131
verificationStatus: TEST_ACCEPTED
129132
verifiedWith: []
130133
documentation_of: test/multiplication_of_big_integers.fft.test.cpp

test/point_add_range_sum.test.cpp.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ data:
103103
isVerificationFile: true
104104
path: test/point_add_range_sum.test.cpp
105105
requiredBy: []
106-
timestamp: '2025-11-06 23:46:32+08:00'
106+
timestamp: '2025-11-07 09:14:02+08:00'
107107
verificationStatus: TEST_ACCEPTED
108108
verifiedWith: []
109109
documentation_of: test/point_add_range_sum.test.cpp

0 commit comments

Comments
 (0)