From 0fa05293da4aa27226d6f7e61a0ac497d5db3f94 Mon Sep 17 00:00:00 2001 From: GitHub Date: Sun, 22 Oct 2023 08:45:08 +0000 Subject: [PATCH] [auto-verifier] docs commit 8ab7b42f9af47dac712ab1a6d8cc2260ea82632b --- DP/lis.h.md | 2 +- DataStructure/Fenwick/Fenwick.h.md | 2 +- DataStructure/HeavyLight_adamant.h.md | 8 +- DataStructure/LazySegTree.h.md | 12 +- DataStructure/LiChaoSegTree.h.md | 2 +- DataStructure/LinkCutTree.h.md | 2 +- DataStructure/RMQ.h.md | 4 +- DataStructure/RangeSet.h.md | 2 +- DataStructure/STL/pbds_faster_map.h.md | 11 +- DataStructure/SegTree.h.md | 10 +- DataStructure/misc/{vec.h.md => ndvec.h.md} | 14 +- Geometry/basic.h.md | 38 +++--- Geometry/circle.h.md | 6 +- Geometry/polygon.h.md | 12 +- Graph/DfsTree/BridgeArticulation.h.md | 2 +- Graph/DfsTree/StronglyConnected.h.md | 4 +- Graph/tree_diameter.h.md | 2 +- ML/lightbgm_example.py.md | 4 +- Math/Matrix.h.md | 4 +- Math/NumberTheory/ExtendedEuclid.h.md | 2 +- .../{Pollard.h.md => Pollard_factorize.h.md} | 93 ++++++------- Math/NumberTheory/cnt_divisors.h.md | 118 ++++++++-------- Math/Polynomial/NTT.h.md | 4 +- Math/Prime/Sieve.h.md | 2 +- Math/bigint.h.md | 8 +- Math/modint.h.md | 26 ++-- Math/tests/aizu_ntl_1_a_factorize.test.cpp.md | 24 ++-- Math/tests/cnt_divisors_stress.test.cpp.md | 16 +-- Math/tests/factorize.test.cpp.md | 88 ++++++------ Math/tests/is_prime_yukicoder.test.cpp.md | 22 +-- Math/tests/yosupo_bigint_add.test.cpp.md | 8 +- Misc/compress.h.md | 4 +- String/SuffixArray.h.md | 2 +- String/hash.h.md | 8 +- buffered_reader.h.md | 18 +-- index.md | 10 +- template.h.md | 128 +++++++++--------- 37 files changed, 365 insertions(+), 357 deletions(-) rename DataStructure/misc/{vec.h.md => ndvec.h.md} (87%) rename Math/NumberTheory/{Pollard.h.md => Pollard_factorize.h.md} (68%) diff --git a/DP/lis.h.md b/DP/lis.h.md index 0bbd9bee..b4f2ffb3 100644 --- a/DP/lis.h.md +++ b/DP/lis.h.md @@ -92,8 +92,8 @@ data: timestamp: '2022-11-29 22:46:48+08:00' verificationStatus: LIBRARY_ALL_AC verifiedWith: - - DP/tests/aizu_dpl_1_d_lis.test.cpp - DP/tests/yosupo_lis.test.cpp + - DP/tests/aizu_dpl_1_d_lis.test.cpp documentation_of: DP/lis.h layout: document redirect_from: diff --git a/DataStructure/Fenwick/Fenwick.h.md b/DataStructure/Fenwick/Fenwick.h.md index 15f73d0d..a1a924d0 100644 --- a/DataStructure/Fenwick/Fenwick.h.md +++ b/DataStructure/Fenwick/Fenwick.h.md @@ -61,8 +61,8 @@ data: verificationStatus: LIBRARY_ALL_AC verifiedWith: - DP/tests/aizu_alds1_5_d_count_inversions.test.cpp - - DataStructure/test/fenwick_pointaddrangesum.test.cpp - DataStructure/test/aizu_dsl_2_b_fenwick_aizu.test.cpp + - DataStructure/test/fenwick_pointaddrangesum.test.cpp - DataStructure/test/fenwick.test.cpp documentation_of: DataStructure/Fenwick/Fenwick.h layout: document diff --git a/DataStructure/HeavyLight_adamant.h.md b/DataStructure/HeavyLight_adamant.h.md index a2fdc8ef..b29e0872 100644 --- a/DataStructure/HeavyLight_adamant.h.md +++ b/DataStructure/HeavyLight_adamant.h.md @@ -243,12 +243,12 @@ data: verificationStatus: LIBRARY_ALL_AC verifiedWith: - DataStructure/test/hld_vertexsetpathcomposite.test.cpp - - DataStructure/test/aizu_grl_5_c_hld_lca.test.cpp - - DataStructure/test/hld_vertexaddpathsum.test.cpp - - DataStructure/test/hld_lca.test.cpp - - DataStructure/test/aizu_grl_5_e_hld_edge.test.cpp - DataStructure/test/yosupo_hld_kth_vertex_on_path.test.cpp - DataStructure/test/aizu_grl_5_d_hld_edge.test.cpp + - DataStructure/test/hld_vertexaddpathsum.test.cpp + - DataStructure/test/aizu_grl_5_c_hld_lca.test.cpp + - DataStructure/test/aizu_grl_5_e_hld_edge.test.cpp + - DataStructure/test/hld_lca.test.cpp - DataStructure/test/hld_vertexaddsubtreesum.test.cpp documentation_of: DataStructure/HeavyLight_adamant.h layout: document diff --git a/DataStructure/LazySegTree.h.md b/DataStructure/LazySegTree.h.md index 0cb44c6d..00163987 100644 --- a/DataStructure/LazySegTree.h.md +++ b/DataStructure/LazySegTree.h.md @@ -262,16 +262,16 @@ data: timestamp: '2022-08-09 14:38:08+08:00' verificationStatus: LIBRARY_ALL_AC verifiedWith: - - DataStructure/test/aizu_dsl_2_d_segment_tree_rangeset.test.cpp - - DataStructure/test/aizu_dsl_2_h_segment_tree_rangeaddmin.test.cpp - - DataStructure/test/segment_tree_rangeaffinepointget.test.cpp + - DataStructure/test/aizu_dsl_2_f_segment_tree_rangesetmin.test.cpp - DataStructure/test/area_of_union_of_rectangles.test.cpp - DataStructure/test/aizu_dsl_2_g_segment_tree_rangeaddsum.test.cpp - - DataStructure/test/segment_tree_rangeaffinerangesum.test.cpp - - DataStructure/test/aizu_dsl_2_i_segment_tree_rangesetsum.test.cpp + - DataStructure/test/segment_tree_rangeaffinepointget.test.cpp - DataStructure/test/aizu_grl_5_e_hld_edge.test.cpp + - DataStructure/test/aizu_dsl_2_d_segment_tree_rangeset.test.cpp + - DataStructure/test/segment_tree_rangeaffinerangesum.test.cpp - DataStructure/test/aizu_dsl_2_e_segment_tree_rangeadd.test.cpp - - DataStructure/test/aizu_dsl_2_f_segment_tree_rangesetmin.test.cpp + - DataStructure/test/aizu_dsl_2_h_segment_tree_rangeaddmin.test.cpp + - DataStructure/test/aizu_dsl_2_i_segment_tree_rangesetsum.test.cpp documentation_of: DataStructure/LazySegTree.h layout: document redirect_from: diff --git a/DataStructure/LiChaoSegTree.h.md b/DataStructure/LiChaoSegTree.h.md index 379e20f7..95d2e1b2 100644 --- a/DataStructure/LiChaoSegTree.h.md +++ b/DataStructure/LiChaoSegTree.h.md @@ -126,8 +126,8 @@ data: timestamp: '2022-01-03 02:31:11+08:00' verificationStatus: LIBRARY_ALL_AC verifiedWith: - - DataStructure/test/li_chao_seg_tree_lineaddgetmin.test.cpp - DataStructure/test/li_chao_seg_tree_segaddgetmin.test.cpp + - DataStructure/test/li_chao_seg_tree_lineaddgetmin.test.cpp documentation_of: DataStructure/LiChaoSegTree.h layout: document redirect_from: diff --git a/DataStructure/LinkCutTree.h.md b/DataStructure/LinkCutTree.h.md index 75ff1b38..fe6433df 100644 --- a/DataStructure/LinkCutTree.h.md +++ b/DataStructure/LinkCutTree.h.md @@ -186,8 +186,8 @@ data: verificationStatus: LIBRARY_ALL_AC verifiedWith: - DataStructure/test/link_cut_tree_vertexsetpathcomposite.test.cpp - - DataStructure/test/link_cut_tree_vertexaddsubtreesum.test.cpp - DataStructure/test/link_cut_tree_addpathsum.test.cpp + - DataStructure/test/link_cut_tree_vertexaddsubtreesum.test.cpp documentation_of: DataStructure/LinkCutTree.h layout: document redirect_from: diff --git a/DataStructure/RMQ.h.md b/DataStructure/RMQ.h.md index 004d2f79..6f952e6a 100644 --- a/DataStructure/RMQ.h.md +++ b/DataStructure/RMQ.h.md @@ -67,12 +67,12 @@ data: timestamp: '2022-08-11 17:15:37+08:00' verificationStatus: LIBRARY_ALL_AC verifiedWith: - - String/tests/suffix_array.test.cpp - String/tests/lcp.test.cpp + - String/tests/suffix_array.test.cpp - String/tests/suffix_array_queries.test.cpp - DataStructure/test/aizu_grl_5_c_lca.test.cpp - - DataStructure/test/lca.test.cpp - DataStructure/test/rmq.test.cpp + - DataStructure/test/lca.test.cpp documentation_of: DataStructure/RMQ.h layout: document redirect_from: diff --git a/DataStructure/RangeSet.h.md b/DataStructure/RangeSet.h.md index 75923f24..ff6a2017 100644 --- a/DataStructure/RangeSet.h.md +++ b/DataStructure/RangeSet.h.md @@ -99,8 +99,8 @@ data: timestamp: '2022-12-31 08:30:35+00:00' verificationStatus: LIBRARY_ALL_AC verifiedWith: - - DataStructure/test/yukicoder_674_range_set.test.cpp - DataStructure/test/aizu_dsl_2_d_rangeset.test.cpp + - DataStructure/test/yukicoder_674_range_set.test.cpp - DataStructure/test/aizu_dsl_4_a_range_set.test.cpp documentation_of: DataStructure/RangeSet.h layout: document diff --git a/DataStructure/STL/pbds_faster_map.h.md b/DataStructure/STL/pbds_faster_map.h.md index ee651051..12c8a03b 100644 --- a/DataStructure/STL/pbds_faster_map.h.md +++ b/DataStructure/STL/pbds_faster_map.h.md @@ -12,7 +12,9 @@ data: - https://codeforces.com/contest/1006/submission/41804666 - https://ideone.com/LhpILA bundledCode: "#line 1 \"DataStructure/STL/pbds_faster_map.h\"\n// From https://codeforces.com/blog/entry/60737\n\ - \n// Code copied from https://codeforces.com/contest/1006/submission/41804666\n\ + \n// Note: it's probably useful to test if these tricks make unordered_map fast\ + \ enough first:\n// unordered_map<...> mp;\n// mp.reserve(N); // maybe use 2^x?\n\ + // mp.max_load_factor(0.25);\n\n// Code copied from https://codeforces.com/contest/1006/submission/41804666\n\ #include \nusing namespace __gnu_pbds;\n\nunsigned\ \ hash_f(unsigned x) {\n x = ((x >> 16) ^ x) * 0x45d9f3b;\n x = ((x >> 16)\ \ ^ x) * 0x45d9f3b;\n x = (x >> 16) ^ x;\n return x;\n}\nstruct chash {\n\ @@ -22,7 +24,10 @@ data: const ll SEED = (ll)(new ll);\nconst ll RANDOM = TIME ^ SEED;\nconst ll MOD =\ \ (int)1e9+7;\nconst ll MUL = (int)1e6+3;\n\nstruct chash{\n ll operator()(ll\ \ x) const { return std::hash{}((x ^ RANDOM) % MOD * MUL); }\n};\n" - code: "// From https://codeforces.com/blog/entry/60737\n\n// Code copied from https://codeforces.com/contest/1006/submission/41804666\n\ + code: "// From https://codeforces.com/blog/entry/60737\n\n// Note: it's probably\ + \ useful to test if these tricks make unordered_map fast enough first:\n// unordered_map<...>\ + \ mp;\n// mp.reserve(N); // maybe use 2^x?\n// mp.max_load_factor(0.25);\n\n\ + // Code copied from https://codeforces.com/contest/1006/submission/41804666\n\ #include \nusing namespace __gnu_pbds;\n\nunsigned\ \ hash_f(unsigned x) {\n x = ((x >> 16) ^ x) * 0x45d9f3b;\n x = ((x >> 16)\ \ ^ x) * 0x45d9f3b;\n x = (x >> 16) ^ x;\n return x;\n}\nstruct chash {\n\ @@ -36,7 +41,7 @@ data: isVerificationFile: false path: DataStructure/STL/pbds_faster_map.h requiredBy: [] - timestamp: '2020-12-03 13:14:44+08:00' + timestamp: '2023-10-22 16:42:38+08:00' verificationStatus: LIBRARY_NO_TESTS verifiedWith: [] documentation_of: DataStructure/STL/pbds_faster_map.h diff --git a/DataStructure/SegTree.h.md b/DataStructure/SegTree.h.md index d2cc32d1..ae9b6204 100644 --- a/DataStructure/SegTree.h.md +++ b/DataStructure/SegTree.h.md @@ -186,15 +186,15 @@ data: verificationStatus: LIBRARY_ALL_AC verifiedWith: - DataStructure/test/hld_vertexsetpathcomposite.test.cpp - - DataStructure/test/segment_tree_2d_pointaddrectsum.test.cpp - - DataStructure/test/segment_tree_staticrmq.test.cpp - - DataStructure/test/hld_vertexaddpathsum.test.cpp - - DataStructure/test/segment_tree_pointsetrangecomposite.test.cpp - - DataStructure/test/segment_tree_pointaddrangesum.test.cpp - DataStructure/test/aizu_dsl_2_b_segment_tree_sum.test.cpp - DataStructure/test/aizu_dsl_2_a_segment_tree_rmq_update.test.cpp - DataStructure/test/aizu_grl_5_d_hld_edge.test.cpp + - DataStructure/test/hld_vertexaddpathsum.test.cpp + - DataStructure/test/segment_tree_pointaddrangesum.test.cpp + - DataStructure/test/segment_tree_pointsetrangecomposite.test.cpp + - DataStructure/test/segment_tree_2d_pointaddrectsum.test.cpp - DataStructure/test/hld_vertexaddsubtreesum.test.cpp + - DataStructure/test/segment_tree_staticrmq.test.cpp documentation_of: DataStructure/SegTree.h layout: document redirect_from: diff --git a/DataStructure/misc/vec.h.md b/DataStructure/misc/ndvec.h.md similarity index 87% rename from DataStructure/misc/vec.h.md rename to DataStructure/misc/ndvec.h.md index 445def50..dc189c1d 100644 --- a/DataStructure/misc/vec.h.md +++ b/DataStructure/misc/ndvec.h.md @@ -9,7 +9,7 @@ data: attributes: links: - https://codeforces.com/blog/entry/76149 - bundledCode: "#line 1 \"DataStructure/misc/vec.h\"\n// Copied from https://codeforces.com/blog/entry/76149\n\ + bundledCode: "#line 1 \"DataStructure/misc/ndvec.h\"\n// Copied from https://codeforces.com/blog/entry/76149\n\ \n// n-d vector {{{\ntemplate\nstruct Vec : public vector> {\n static_assert(D >= 1, \"Dimension must be positive\");\n \ \ template\n Vec(int n = 0, Args... args) : vector= md) res -= md;\n if (res\ - \ < 0) res += md;\n return res;\n}\n\nll powMod(ll x, ll p, ll md) {\n if\ - \ (p == 0) return 1;\n if (p & 1) return mult(x, powMod(x, p - 1, md), md);\n\ - \ return powMod(mult(x, x, md), p / 2, md);\n}\n\nbool checkMillerRabin(ll\ - \ x, ll md, ll s, int k) {\n x = powMod(x, s, md);\n if (x == 1) return\ - \ true;\n while(k--) {\n if (x == md - 1) return true;\n x =\ - \ mult(x, x, md);\n if (x == 1) return false;\n }\n return false;\n\ - }\nbool isPrime(ll x) {\n if (x == 2 || x == 3 || x == 5 || x == 7) return\ - \ true;\n if (x % 2 == 0 || x % 3 == 0 || x % 5 == 0 || x % 7 == 0) return\ - \ false;\n if (x < 121) return x > 1;\n ll s = x - 1;\n int k = 0;\n\ - \ while(s % 2 == 0) {\n s >>= 1;\n k++;\n }\n if (x < 1LL\ - \ << 32) {\n for (ll z : {2, 7, 61}) {\n if (!checkMillerRabin(z,\ - \ x, s, k)) return false;\n }\n } else {\n for (ll z : {2, 325,\ - \ 9375, 28178, 450775, 9780504, 1795265022}) {\n if (!checkMillerRabin(z,\ - \ x, s, k)) return false;\n }\n }\n return true;\n}\n\nll gcd(ll\ - \ x, ll y) {\n return y == 0 ? x : gcd(y, x % y);\n}\n\nvoid pollard(ll x,\ - \ vector &ans) {\n if (isPrime(x)) {\n ans.push_back(x);\n \ - \ return;\n }\n ll c = 1;\n while(true) {\n c = 1 + get_rand(x\ - \ - 1);\n auto f = [&](ll y) {\n ll res = mult(y, y, x) + c;\n\ - \ if (res >= x) res -= x;\n return res;\n };\n \ - \ ll y = 2;\n int B = 100;\n int len = 1;\n ll g = 1;\n\ - \ while(g == 1) {\n ll z = y;\n for (int i = 0; i\ - \ < len; i++) {\n z = f(z);\n }\n ll zs =\ - \ -1;\n int lft = len;\n while(g == 1 && lft > 0) {\n \ - \ zs = z;\n ll p = 1;\n for (int i\ - \ = 0; i < B && i < lft; i++) {\n p = mult(p, abs(z - y), x);\n\ - \ z = f(z);\n }\n g = gcd(p,\ - \ x);\n lft -= B;\n }\n if (g == 1) {\n \ - \ y = z;\n len <<= 1;\n continue;\n\ - \ }\n if (g == x) {\n g = 1;\n \ - \ z = zs;\n while(g == 1) {\n g = gcd(abs(z\ - \ - y), x);\n z = f(z);\n }\n }\n\ - \ if (g == x) break;\n assert(g != 1);\n pollard(g,\ + bundledCode: "#line 1 \"Math/NumberTheory/Pollard_factorize.h\"\n// Copied from\ + \ https://judge.yosupo.jp/submission/61447\n// O(N^0.25)\n//\n// Tested:\n// -\ + \ (up to 10^18; 200 tests) https://judge.yosupo.jp/problem/factorize\n// - https://oj.vnoi.info/problem/icpc21_beta_l\n\ + // - https://www.spoj.com/problems/FACT0/\n//\n// Pollard {{{\nusing ll = long\ + \ long;\nusing ull = unsigned long long;\nusing ld = long double;\nll mult(ll\ + \ x, ll y, ll md) {\n ull q = (ld)x * y / md;\n ll res = ((ull)x * y - q\ + \ * md);\n if (res >= md) res -= md;\n if (res < 0) res += md;\n return\ + \ res;\n}\n\nll powMod(ll x, ll p, ll md) {\n if (p == 0) return 1;\n if\ + \ (p & 1) return mult(x, powMod(x, p - 1, md), md);\n return powMod(mult(x,\ + \ x, md), p / 2, md);\n}\n\nbool checkMillerRabin(ll x, ll md, ll s, int k) {\n\ + \ x = powMod(x, s, md);\n if (x == 1) return true;\n while(k--) {\n \ + \ if (x == md - 1) return true;\n x = mult(x, x, md);\n if\ + \ (x == 1) return false;\n }\n return false;\n}\nbool isPrime(ll x) {\n\ + \ if (x == 2 || x == 3 || x == 5 || x == 7) return true;\n if (x % 2 ==\ + \ 0 || x % 3 == 0 || x % 5 == 0 || x % 7 == 0) return false;\n if (x < 121)\ + \ return x > 1;\n ll s = x - 1;\n int k = 0;\n while(s % 2 == 0) {\n\ + \ s >>= 1;\n k++;\n }\n if (x < 1LL << 32) {\n for\ + \ (ll z : {2, 7, 61}) {\n if (!checkMillerRabin(z, x, s, k)) return\ + \ false;\n }\n } else {\n for (ll z : {2, 325, 9375, 28178, 450775,\ + \ 9780504, 1795265022}) {\n if (!checkMillerRabin(z, x, s, k)) return\ + \ false;\n }\n }\n return true;\n}\n\nll gcd(ll x, ll y) {\n return\ + \ y == 0 ? x : gcd(y, x % y);\n}\n\nvoid pollard(ll x, vector &ans) {\n \ + \ if (isPrime(x)) {\n ans.push_back(x);\n return;\n }\n ll\ + \ c = 1;\n while(true) {\n c = 1 + get_rand(x - 1);\n auto f\ + \ = [&](ll y) {\n ll res = mult(y, y, x) + c;\n if (res\ + \ >= x) res -= x;\n return res;\n };\n ll y = 2;\n \ + \ int B = 100;\n int len = 1;\n ll g = 1;\n while(g\ + \ == 1) {\n ll z = y;\n for (int i = 0; i < len; i++) {\n\ + \ z = f(z);\n }\n ll zs = -1;\n \ + \ int lft = len;\n while(g == 1 && lft > 0) {\n zs\ + \ = z;\n ll p = 1;\n for (int i = 0; i < B && i\ + \ < lft; i++) {\n p = mult(p, abs(z - y), x);\n \ + \ z = f(z);\n }\n g = gcd(p, x);\n \ + \ lft -= B;\n }\n if (g == 1) {\n \ + \ y = z;\n len <<= 1;\n continue;\n \ + \ }\n if (g == x) {\n g = 1;\n z =\ + \ zs;\n while(g == 1) {\n g = gcd(abs(z - y),\ + \ x);\n z = f(z);\n }\n }\n \ + \ if (g == x) break;\n assert(g != 1);\n pollard(g,\ \ ans);\n pollard(x / g, ans);\n return;\n }\n \ \ }\n}\n// return list of all prime factors of x (can have duplicates)\nvector\ \ factorize(ll x) {\n vector ans;\n for (ll p : {2, 3, 5, 7, 11, 13,\ @@ -141,20 +142,20 @@ data: \ sort(res.begin(), res.end());\n return res;\n}\n// }}}\n" dependsOn: [] isVerificationFile: false - path: Math/NumberTheory/Pollard.h + path: Math/NumberTheory/Pollard_factorize.h requiredBy: - Math/NumberTheory/cnt_divisors.h - timestamp: '2023-02-03 11:07:24+08:00' + timestamp: '2023-10-22 16:42:38+08:00' verificationStatus: LIBRARY_ALL_AC verifiedWith: - - Math/tests/is_prime_yukicoder.test.cpp - - Math/tests/factorize.test.cpp - Math/tests/aizu_ntl_1_a_factorize.test.cpp + - Math/tests/factorize.test.cpp - Math/tests/cnt_divisors_stress.test.cpp -documentation_of: Math/NumberTheory/Pollard.h + - Math/tests/is_prime_yukicoder.test.cpp +documentation_of: Math/NumberTheory/Pollard_factorize.h layout: document redirect_from: -- /library/Math/NumberTheory/Pollard.h -- /library/Math/NumberTheory/Pollard.h.html -title: Math/NumberTheory/Pollard.h +- /library/Math/NumberTheory/Pollard_factorize.h +- /library/Math/NumberTheory/Pollard_factorize.h.html +title: Math/NumberTheory/Pollard_factorize.h --- diff --git a/Math/NumberTheory/cnt_divisors.h.md b/Math/NumberTheory/cnt_divisors.h.md index 520819e4..0cd9ab95 100644 --- a/Math/NumberTheory/cnt_divisors.h.md +++ b/Math/NumberTheory/cnt_divisors.h.md @@ -2,8 +2,8 @@ data: _extendedDependsOn: - icon: ':heavy_check_mark:' - path: Math/NumberTheory/Pollard.h - title: Math/NumberTheory/Pollard.h + path: Math/NumberTheory/Pollard_factorize.h + title: Math/NumberTheory/Pollard_factorize.h - icon: ':heavy_check_mark:' path: Math/Prime/Sieve.h title: Math/Prime/Sieve.h @@ -18,44 +18,45 @@ data: attributes: links: - https://www.spoj.com/problems/NUMDIV/ - bundledCode: "#line 1 \"Math/NumberTheory/Pollard.h\"\n// Copied from https://judge.yosupo.jp/submission/61447\n\ - // O(N^0.25)\n//\n// Tested:\n// - (up to 10^18; 200 tests) https://judge.yosupo.jp/problem/factorize\n\ - // - https://oj.vnoi.info/problem/icpc21_beta_l\n// - https://www.spoj.com/problems/FACT0/\n\ - //\n// Pollard {{{\nusing ll = long long;\nusing ull = unsigned long long;\nusing\ - \ ld = long double;\nll mult(ll x, ll y, ll md) {\n ull q = (ld)x * y / md;\n\ - \ ll res = ((ull)x * y - q * md);\n if (res >= md) res -= md;\n if (res\ - \ < 0) res += md;\n return res;\n}\n\nll powMod(ll x, ll p, ll md) {\n if\ - \ (p == 0) return 1;\n if (p & 1) return mult(x, powMod(x, p - 1, md), md);\n\ - \ return powMod(mult(x, x, md), p / 2, md);\n}\n\nbool checkMillerRabin(ll\ - \ x, ll md, ll s, int k) {\n x = powMod(x, s, md);\n if (x == 1) return\ - \ true;\n while(k--) {\n if (x == md - 1) return true;\n x =\ - \ mult(x, x, md);\n if (x == 1) return false;\n }\n return false;\n\ - }\nbool isPrime(ll x) {\n if (x == 2 || x == 3 || x == 5 || x == 7) return\ - \ true;\n if (x % 2 == 0 || x % 3 == 0 || x % 5 == 0 || x % 7 == 0) return\ - \ false;\n if (x < 121) return x > 1;\n ll s = x - 1;\n int k = 0;\n\ - \ while(s % 2 == 0) {\n s >>= 1;\n k++;\n }\n if (x < 1LL\ - \ << 32) {\n for (ll z : {2, 7, 61}) {\n if (!checkMillerRabin(z,\ - \ x, s, k)) return false;\n }\n } else {\n for (ll z : {2, 325,\ - \ 9375, 28178, 450775, 9780504, 1795265022}) {\n if (!checkMillerRabin(z,\ - \ x, s, k)) return false;\n }\n }\n return true;\n}\n\nll gcd(ll\ - \ x, ll y) {\n return y == 0 ? x : gcd(y, x % y);\n}\n\nvoid pollard(ll x,\ - \ vector &ans) {\n if (isPrime(x)) {\n ans.push_back(x);\n \ - \ return;\n }\n ll c = 1;\n while(true) {\n c = 1 + get_rand(x\ - \ - 1);\n auto f = [&](ll y) {\n ll res = mult(y, y, x) + c;\n\ - \ if (res >= x) res -= x;\n return res;\n };\n \ - \ ll y = 2;\n int B = 100;\n int len = 1;\n ll g = 1;\n\ - \ while(g == 1) {\n ll z = y;\n for (int i = 0; i\ - \ < len; i++) {\n z = f(z);\n }\n ll zs =\ - \ -1;\n int lft = len;\n while(g == 1 && lft > 0) {\n \ - \ zs = z;\n ll p = 1;\n for (int i\ - \ = 0; i < B && i < lft; i++) {\n p = mult(p, abs(z - y), x);\n\ - \ z = f(z);\n }\n g = gcd(p,\ - \ x);\n lft -= B;\n }\n if (g == 1) {\n \ - \ y = z;\n len <<= 1;\n continue;\n\ - \ }\n if (g == x) {\n g = 1;\n \ - \ z = zs;\n while(g == 1) {\n g = gcd(abs(z\ - \ - y), x);\n z = f(z);\n }\n }\n\ - \ if (g == x) break;\n assert(g != 1);\n pollard(g,\ + bundledCode: "#line 1 \"Math/NumberTheory/Pollard_factorize.h\"\n// Copied from\ + \ https://judge.yosupo.jp/submission/61447\n// O(N^0.25)\n//\n// Tested:\n// -\ + \ (up to 10^18; 200 tests) https://judge.yosupo.jp/problem/factorize\n// - https://oj.vnoi.info/problem/icpc21_beta_l\n\ + // - https://www.spoj.com/problems/FACT0/\n//\n// Pollard {{{\nusing ll = long\ + \ long;\nusing ull = unsigned long long;\nusing ld = long double;\nll mult(ll\ + \ x, ll y, ll md) {\n ull q = (ld)x * y / md;\n ll res = ((ull)x * y - q\ + \ * md);\n if (res >= md) res -= md;\n if (res < 0) res += md;\n return\ + \ res;\n}\n\nll powMod(ll x, ll p, ll md) {\n if (p == 0) return 1;\n if\ + \ (p & 1) return mult(x, powMod(x, p - 1, md), md);\n return powMod(mult(x,\ + \ x, md), p / 2, md);\n}\n\nbool checkMillerRabin(ll x, ll md, ll s, int k) {\n\ + \ x = powMod(x, s, md);\n if (x == 1) return true;\n while(k--) {\n \ + \ if (x == md - 1) return true;\n x = mult(x, x, md);\n if\ + \ (x == 1) return false;\n }\n return false;\n}\nbool isPrime(ll x) {\n\ + \ if (x == 2 || x == 3 || x == 5 || x == 7) return true;\n if (x % 2 ==\ + \ 0 || x % 3 == 0 || x % 5 == 0 || x % 7 == 0) return false;\n if (x < 121)\ + \ return x > 1;\n ll s = x - 1;\n int k = 0;\n while(s % 2 == 0) {\n\ + \ s >>= 1;\n k++;\n }\n if (x < 1LL << 32) {\n for\ + \ (ll z : {2, 7, 61}) {\n if (!checkMillerRabin(z, x, s, k)) return\ + \ false;\n }\n } else {\n for (ll z : {2, 325, 9375, 28178, 450775,\ + \ 9780504, 1795265022}) {\n if (!checkMillerRabin(z, x, s, k)) return\ + \ false;\n }\n }\n return true;\n}\n\nll gcd(ll x, ll y) {\n return\ + \ y == 0 ? x : gcd(y, x % y);\n}\n\nvoid pollard(ll x, vector &ans) {\n \ + \ if (isPrime(x)) {\n ans.push_back(x);\n return;\n }\n ll\ + \ c = 1;\n while(true) {\n c = 1 + get_rand(x - 1);\n auto f\ + \ = [&](ll y) {\n ll res = mult(y, y, x) + c;\n if (res\ + \ >= x) res -= x;\n return res;\n };\n ll y = 2;\n \ + \ int B = 100;\n int len = 1;\n ll g = 1;\n while(g\ + \ == 1) {\n ll z = y;\n for (int i = 0; i < len; i++) {\n\ + \ z = f(z);\n }\n ll zs = -1;\n \ + \ int lft = len;\n while(g == 1 && lft > 0) {\n zs\ + \ = z;\n ll p = 1;\n for (int i = 0; i < B && i\ + \ < lft; i++) {\n p = mult(p, abs(z - y), x);\n \ + \ z = f(z);\n }\n g = gcd(p, x);\n \ + \ lft -= B;\n }\n if (g == 1) {\n \ + \ y = z;\n len <<= 1;\n continue;\n \ + \ }\n if (g == x) {\n g = 1;\n z =\ + \ zs;\n while(g == 1) {\n g = gcd(abs(z - y),\ + \ x);\n z = f(z);\n }\n }\n \ + \ if (g == x) break;\n assert(g != 1);\n pollard(g,\ \ ans);\n pollard(x / g, ans);\n return;\n }\n \ \ }\n}\n// return list of all prime factors of x (can have duplicates)\nvector\ \ factorize(ll x) {\n vector ans;\n for (ll p : {2, 3, 5, 7, 11, 13,\ @@ -103,29 +104,30 @@ data: \ k = 0;\n while (cur[i-l] % p == 0) cur[i-l] /= p, ++k;\n\n \ \ cnt[i - l] *= k + 1;\n }\n }\n for (int i = l; i <= r; ++i)\ \ {\n if (cur[i-l] > 1) cnt[i-l] *= 2;\n }\n return cnt;\n}\n// }}}\n" - code: "#include \"Pollard.h\"\n#include \"../Prime/Sieve.h\"\n\n// Tested: https://www.spoj.com/problems/NUMDIV/\n\ - int64_t cnt_divisors(int64_t n) {\n assert(n > 0);\n auto ps = factorize(n);\n\ - \ int cnt_ps = ps.size();\n int i = 0;\n int64_t res = 1;\n while\ - \ (i < cnt_ps) {\n int j = i;\n while (j+1 < cnt_ps && ps[j+1] ==\ - \ ps[j]) ++j;\n res *= j - i + 2;\n i = j + 1;\n }\n return\ - \ res;\n}\n\n// Count divisors Using Segmented Sieve O(sieve(sqrt(R)) + (R-L)*log)\ - \ {{{\n// Returns vector of length (r - l + 1), where the i-th element is number\ - \ of\n// divisors of i - l\nvector cnt_divisors_segmented_sieve(int l, int\ - \ r) {\n int s = sqrt(r + 0.5);\n vector primes;\n auto newPrime\ - \ = [&] (int p) { primes.push_back(p); };\n sieve(s, newPrime);\n\n vector\ - \ cnt(r - l + 1, 1), cur(r - l + 1);\n std::iota(cur.begin(), cur.end(), l);\n\ - \n for (int p : primes) {\n if (p > r) break;\n\n int u = (l\ - \ + p - 1) / p * p;\n for (int i = u; i <= r; i += p) {\n int\ - \ k = 0;\n while (cur[i-l] % p == 0) cur[i-l] /= p, ++k;\n\n \ - \ cnt[i - l] *= k + 1;\n }\n }\n for (int i = l; i <= r; ++i)\ - \ {\n if (cur[i-l] > 1) cnt[i-l] *= 2;\n }\n return cnt;\n}\n// }}}\n" + code: "#include \"Pollard_factorize.h\"\n#include \"../Prime/Sieve.h\"\n\n// Tested:\ + \ https://www.spoj.com/problems/NUMDIV/\nint64_t cnt_divisors(int64_t n) {\n \ + \ assert(n > 0);\n auto ps = factorize(n);\n int cnt_ps = ps.size();\n\ + \ int i = 0;\n int64_t res = 1;\n while (i < cnt_ps) {\n int j\ + \ = i;\n while (j+1 < cnt_ps && ps[j+1] == ps[j]) ++j;\n res *=\ + \ j - i + 2;\n i = j + 1;\n }\n return res;\n}\n\n// Count divisors\ + \ Using Segmented Sieve O(sieve(sqrt(R)) + (R-L)*log) {{{\n// Returns vector of\ + \ length (r - l + 1), where the i-th element is number of\n// divisors of i -\ + \ l\nvector cnt_divisors_segmented_sieve(int l, int r) {\n int s = sqrt(r\ + \ + 0.5);\n vector primes;\n auto newPrime = [&] (int p) { primes.push_back(p);\ + \ };\n sieve(s, newPrime);\n\n vector cnt(r - l + 1, 1), cur(r - l\ + \ + 1);\n std::iota(cur.begin(), cur.end(), l);\n\n for (int p : primes)\ + \ {\n if (p > r) break;\n\n int u = (l + p - 1) / p * p;\n \ + \ for (int i = u; i <= r; i += p) {\n int k = 0;\n while\ + \ (cur[i-l] % p == 0) cur[i-l] /= p, ++k;\n\n cnt[i - l] *= k + 1;\n\ + \ }\n }\n for (int i = l; i <= r; ++i) {\n if (cur[i-l] >\ + \ 1) cnt[i-l] *= 2;\n }\n return cnt;\n}\n// }}}\n" dependsOn: - - Math/NumberTheory/Pollard.h + - Math/NumberTheory/Pollard_factorize.h - Math/Prime/Sieve.h isVerificationFile: false path: Math/NumberTheory/cnt_divisors.h requiredBy: [] - timestamp: '2023-02-03 11:07:24+08:00' + timestamp: '2023-10-22 16:42:38+08:00' verificationStatus: LIBRARY_ALL_AC verifiedWith: - Math/tests/cnt_divisors_stress.test.cpp diff --git a/Math/Polynomial/NTT.h.md b/Math/Polynomial/NTT.h.md index 28fd9d2a..ffb05977 100644 --- a/Math/Polynomial/NTT.h.md +++ b/Math/Polynomial/NTT.h.md @@ -143,10 +143,10 @@ data: timestamp: '2022-08-21 23:32:29+08:00' verificationStatus: LIBRARY_ALL_AC verifiedWith: - - Math/tests/ntt_any_mod.test.cpp - Math/tests/formal_power_series_multiply_any_mod.test.cpp - - Math/tests/ntt.test.cpp - Math/tests/formal_power_series_multiply.test.cpp + - Math/tests/ntt.test.cpp + - Math/tests/ntt_any_mod.test.cpp documentation_of: Math/Polynomial/NTT.h layout: document redirect_from: diff --git a/Math/Prime/Sieve.h.md b/Math/Prime/Sieve.h.md index 7e50d11b..acff4acf 100644 --- a/Math/Prime/Sieve.h.md +++ b/Math/Prime/Sieve.h.md @@ -52,8 +52,8 @@ data: timestamp: '2022-12-14 02:22:04+08:00' verificationStatus: LIBRARY_ALL_AC verifiedWith: - - Math/tests/sieve.test.cpp - Math/tests/cnt_divisors_stress.test.cpp + - Math/tests/sieve.test.cpp documentation_of: Math/Prime/Sieve.h layout: document redirect_from: diff --git a/Math/bigint.h.md b/Math/bigint.h.md index 51b9e01f..afc1b82e 100644 --- a/Math/bigint.h.md +++ b/Math/bigint.h.md @@ -531,14 +531,14 @@ data: timestamp: '2023-10-03 01:03:14-07:00' verificationStatus: LIBRARY_ALL_AC verifiedWith: - - Math/tests/aizu_ntl_2_e_bigint_mod.test.cpp - - Math/tests/yosupo_bigint_add.test.cpp + - Math/tests/aizu_ntl_2_c_bigint_mul_karatsuba.test.cpp - Math/tests/aizu_ntl_2_a_bigint_add.test.cpp + - Math/tests/aizu_ntl_2_f_bigint_mul_fft.test.cpp - Math/tests/aizu_ntl_2_d_bigint_div.test.cpp + - Math/tests/yosupo_bigint_add.test.cpp - Math/tests/aizu_ntl_2_b_bigint_sub.test.cpp - - Math/tests/aizu_ntl_2_c_bigint_mul_karatsuba.test.cpp + - Math/tests/aizu_ntl_2_e_bigint_mod.test.cpp - Math/tests/aizu_ntl_2_c_bigint_mul.test.cpp - - Math/tests/aizu_ntl_2_f_bigint_mul_fft.test.cpp documentation_of: Math/bigint.h layout: document redirect_from: diff --git a/Math/modint.h.md b/Math/modint.h.md index 419c4cf3..abadfcae 100644 --- a/Math/modint.h.md +++ b/Math/modint.h.md @@ -205,31 +205,31 @@ data: isVerificationFile: false path: Math/modint.h requiredBy: - - String/hash.h - String/SuffixArray.h + - String/hash.h timestamp: '2023-10-15 09:43:20+08:00' verificationStatus: LIBRARY_ALL_AC verifiedWith: - - Math/tests/berlekamp_massey.test.cpp - - Math/tests/aizu_ntl_1_b_modulo_pow.test.cpp - - Math/tests/ntt_any_mod.test.cpp + - String/tests/lcp.test.cpp + - String/tests/yukicoder_1408_string_hash_lcp.test.cpp + - String/tests/aizu_alds_14_b_string_hash.test.cpp + - String/tests/suffix_array.test.cpp + - String/tests/zfunc_hash.test.cpp + - String/tests/suffix_array_queries.test.cpp - Math/tests/matrix_mult.test.cpp - Math/tests/formal_power_series_multiply_any_mod.test.cpp - - Math/tests/ntt.test.cpp - Math/tests/formal_power_series_multiply.test.cpp - - String/tests/suffix_array.test.cpp - - String/tests/lcp.test.cpp - - String/tests/suffix_array_queries.test.cpp - - String/tests/zfunc_hash.test.cpp - - String/tests/aizu_alds_14_b_string_hash.test.cpp - - String/tests/yukicoder_1408_string_hash_lcp.test.cpp + - Math/tests/berlekamp_massey.test.cpp + - Math/tests/ntt.test.cpp + - Math/tests/ntt_any_mod.test.cpp + - Math/tests/aizu_ntl_1_b_modulo_pow.test.cpp - DP/tests/yosupo_cnt_distinct_subseq.test.cpp + - DataStructure/test/link_cut_tree_vertexsetpathcomposite.test.cpp - DataStructure/test/hld_vertexsetpathcomposite.test.cpp - DataStructure/test/segment_tree_rangeaffinepointget.test.cpp - - DataStructure/test/segment_tree_pointsetrangecomposite.test.cpp - - DataStructure/test/link_cut_tree_vertexsetpathcomposite.test.cpp - DataStructure/test/segment_tree_rangeaffinerangesum.test.cpp - DataStructure/test/splay_tree.test.cpp + - DataStructure/test/segment_tree_pointsetrangecomposite.test.cpp documentation_of: Math/modint.h layout: document redirect_from: diff --git a/Math/tests/aizu_ntl_1_a_factorize.test.cpp.md b/Math/tests/aizu_ntl_1_a_factorize.test.cpp.md index e529ecc9..bce55401 100644 --- a/Math/tests/aizu_ntl_1_a_factorize.test.cpp.md +++ b/Math/tests/aizu_ntl_1_a_factorize.test.cpp.md @@ -2,8 +2,8 @@ data: _extendedDependsOn: - icon: ':heavy_check_mark:' - path: Math/NumberTheory/Pollard.h - title: Math/NumberTheory/Pollard.h + path: Math/NumberTheory/Pollard_factorize.h + title: Math/NumberTheory/Pollard_factorize.h - icon: ':heavy_check_mark:' path: template.h title: template.h @@ -44,10 +44,10 @@ data: \ (0, r-1)(rng);\n}\n\ntemplate\nvector read_vector(int n) {\n\ \ vector res(n);\n for (int& x : res) cin >> x;\n return res;\n}\n\ \nvoid solve();\n\nint main() {\n ios::sync_with_stdio(0); cin.tie(0);\n \ - \ solve();\n return 0;\n}\n#line 1 \"Math/NumberTheory/Pollard.h\"\n// Copied\ - \ from https://judge.yosupo.jp/submission/61447\n// O(N^0.25)\n//\n// Tested:\n\ - // - (up to 10^18; 200 tests) https://judge.yosupo.jp/problem/factorize\n// -\ - \ https://oj.vnoi.info/problem/icpc21_beta_l\n// - https://www.spoj.com/problems/FACT0/\n\ + \ solve();\n return 0;\n}\n#line 1 \"Math/NumberTheory/Pollard_factorize.h\"\ + \n// Copied from https://judge.yosupo.jp/submission/61447\n// O(N^0.25)\n//\n\ + // Tested:\n// - (up to 10^18; 200 tests) https://judge.yosupo.jp/problem/factorize\n\ + // - https://oj.vnoi.info/problem/icpc21_beta_l\n// - https://www.spoj.com/problems/FACT0/\n\ //\n// Pollard {{{\nusing ll = long long;\nusing ull = unsigned long long;\nusing\ \ ld = long double;\nll mult(ll x, ll y, ll md) {\n ull q = (ld)x * y / md;\n\ \ ll res = ((ull)x * y - q * md);\n if (res >= md) res -= md;\n if (res\ @@ -105,17 +105,17 @@ data: \ cout << n << ':';\n for (auto x : facs) cout << ' ' << x;\n cout <<\ \ '\\n';\n}\n" code: "#define PROBLEM \"https://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=NTL_1_A\"\ - \n\n#include \"../../template.h\"\n#include \"../NumberTheory/Pollard.h\"\n\n\ - void solve() {\n int n;\n cin >> n;\n auto facs = factorize(n);\n \ - \ cout << n << ':';\n for (auto x : facs) cout << ' ' << x;\n cout << '\\\ - n';\n}\n" + \n\n#include \"../../template.h\"\n#include \"../NumberTheory/Pollard_factorize.h\"\ + \n\nvoid solve() {\n int n;\n cin >> n;\n auto facs = factorize(n);\n\ + \ cout << n << ':';\n for (auto x : facs) cout << ' ' << x;\n cout <<\ + \ '\\n';\n}\n" dependsOn: - template.h - - Math/NumberTheory/Pollard.h + - Math/NumberTheory/Pollard_factorize.h isVerificationFile: true path: Math/tests/aizu_ntl_1_a_factorize.test.cpp requiredBy: [] - timestamp: '2023-02-03 11:07:24+08:00' + timestamp: '2023-10-22 16:42:38+08:00' verificationStatus: TEST_ACCEPTED verifiedWith: [] documentation_of: Math/tests/aizu_ntl_1_a_factorize.test.cpp diff --git a/Math/tests/cnt_divisors_stress.test.cpp.md b/Math/tests/cnt_divisors_stress.test.cpp.md index e93cea24..6269f3f8 100644 --- a/Math/tests/cnt_divisors_stress.test.cpp.md +++ b/Math/tests/cnt_divisors_stress.test.cpp.md @@ -2,8 +2,8 @@ data: _extendedDependsOn: - icon: ':heavy_check_mark:' - path: Math/NumberTheory/Pollard.h - title: Math/NumberTheory/Pollard.h + path: Math/NumberTheory/Pollard_factorize.h + title: Math/NumberTheory/Pollard_factorize.h - icon: ':heavy_check_mark:' path: Math/NumberTheory/cnt_divisors.h title: Math/NumberTheory/cnt_divisors.h @@ -56,10 +56,10 @@ data: \ (0, r-1)(rng);\n}\n\ntemplate\nvector read_vector(int n) {\n\ \ vector res(n);\n for (int& x : res) cin >> x;\n return res;\n}\n\ \nvoid solve();\n\nint main() {\n ios::sync_with_stdio(0); cin.tie(0);\n \ - \ solve();\n return 0;\n}\n#line 1 \"Math/NumberTheory/Pollard.h\"\n// Copied\ - \ from https://judge.yosupo.jp/submission/61447\n// O(N^0.25)\n//\n// Tested:\n\ - // - (up to 10^18; 200 tests) https://judge.yosupo.jp/problem/factorize\n// -\ - \ https://oj.vnoi.info/problem/icpc21_beta_l\n// - https://www.spoj.com/problems/FACT0/\n\ + \ solve();\n return 0;\n}\n#line 1 \"Math/NumberTheory/Pollard_factorize.h\"\ + \n// Copied from https://judge.yosupo.jp/submission/61447\n// O(N^0.25)\n//\n\ + // Tested:\n// - (up to 10^18; 200 tests) https://judge.yosupo.jp/problem/factorize\n\ + // - https://oj.vnoi.info/problem/icpc21_beta_l\n// - https://www.spoj.com/problems/FACT0/\n\ //\n// Pollard {{{\nusing ll = long long;\nusing ull = unsigned long long;\nusing\ \ ld = long double;\nll mult(ll x, ll y, ll md) {\n ull q = (ld)x * y / md;\n\ \ ll res = ((ull)x * y - q * md);\n if (res >= md) res -= md;\n if (res\ @@ -221,14 +221,14 @@ data: dependsOn: - template.h - Math/NumberTheory/cnt_divisors.h - - Math/NumberTheory/Pollard.h + - Math/NumberTheory/Pollard_factorize.h - Math/Prime/Sieve.h - Math/multiplicative_function.h - Math/multiplicative_functions_linear.h isVerificationFile: true path: Math/tests/cnt_divisors_stress.test.cpp requiredBy: [] - timestamp: '2023-02-03 11:07:24+08:00' + timestamp: '2023-10-22 16:42:38+08:00' verificationStatus: TEST_ACCEPTED verifiedWith: [] documentation_of: Math/tests/cnt_divisors_stress.test.cpp diff --git a/Math/tests/factorize.test.cpp.md b/Math/tests/factorize.test.cpp.md index 0b534a09..2339d0e2 100644 --- a/Math/tests/factorize.test.cpp.md +++ b/Math/tests/factorize.test.cpp.md @@ -2,8 +2,8 @@ data: _extendedDependsOn: - icon: ':heavy_check_mark:' - path: Math/NumberTheory/Pollard.h - title: Math/NumberTheory/Pollard.h + path: Math/NumberTheory/Pollard_factorize.h + title: Math/NumberTheory/Pollard_factorize.h _extendedRequiredBy: [] _extendedVerifiedWith: [] _isVerificationFailed: false @@ -18,45 +18,45 @@ data: \n\n#include \nusing namespace std;\n\n// for 64-bit, use mt19937_64\n\ mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());\nlong\ \ long get_rand(long long r) {\n return uniform_int_distribution\ - \ (0, r-1)(rng);\n}\n\n#line 1 \"Math/NumberTheory/Pollard.h\"\n// Copied from\ - \ https://judge.yosupo.jp/submission/61447\n// O(N^0.25)\n//\n// Tested:\n// -\ - \ (up to 10^18; 200 tests) https://judge.yosupo.jp/problem/factorize\n// - https://oj.vnoi.info/problem/icpc21_beta_l\n\ - // - https://www.spoj.com/problems/FACT0/\n//\n// Pollard {{{\nusing ll = long\ - \ long;\nusing ull = unsigned long long;\nusing ld = long double;\nll mult(ll\ - \ x, ll y, ll md) {\n ull q = (ld)x * y / md;\n ll res = ((ull)x * y - q\ - \ * md);\n if (res >= md) res -= md;\n if (res < 0) res += md;\n return\ - \ res;\n}\n\nll powMod(ll x, ll p, ll md) {\n if (p == 0) return 1;\n if\ - \ (p & 1) return mult(x, powMod(x, p - 1, md), md);\n return powMod(mult(x,\ - \ x, md), p / 2, md);\n}\n\nbool checkMillerRabin(ll x, ll md, ll s, int k) {\n\ - \ x = powMod(x, s, md);\n if (x == 1) return true;\n while(k--) {\n \ - \ if (x == md - 1) return true;\n x = mult(x, x, md);\n if\ - \ (x == 1) return false;\n }\n return false;\n}\nbool isPrime(ll x) {\n\ - \ if (x == 2 || x == 3 || x == 5 || x == 7) return true;\n if (x % 2 ==\ - \ 0 || x % 3 == 0 || x % 5 == 0 || x % 7 == 0) return false;\n if (x < 121)\ - \ return x > 1;\n ll s = x - 1;\n int k = 0;\n while(s % 2 == 0) {\n\ - \ s >>= 1;\n k++;\n }\n if (x < 1LL << 32) {\n for\ - \ (ll z : {2, 7, 61}) {\n if (!checkMillerRabin(z, x, s, k)) return\ - \ false;\n }\n } else {\n for (ll z : {2, 325, 9375, 28178, 450775,\ - \ 9780504, 1795265022}) {\n if (!checkMillerRabin(z, x, s, k)) return\ - \ false;\n }\n }\n return true;\n}\n\nll gcd(ll x, ll y) {\n return\ - \ y == 0 ? x : gcd(y, x % y);\n}\n\nvoid pollard(ll x, vector &ans) {\n \ - \ if (isPrime(x)) {\n ans.push_back(x);\n return;\n }\n ll\ - \ c = 1;\n while(true) {\n c = 1 + get_rand(x - 1);\n auto f\ - \ = [&](ll y) {\n ll res = mult(y, y, x) + c;\n if (res\ - \ >= x) res -= x;\n return res;\n };\n ll y = 2;\n \ - \ int B = 100;\n int len = 1;\n ll g = 1;\n while(g\ - \ == 1) {\n ll z = y;\n for (int i = 0; i < len; i++) {\n\ - \ z = f(z);\n }\n ll zs = -1;\n \ - \ int lft = len;\n while(g == 1 && lft > 0) {\n zs\ - \ = z;\n ll p = 1;\n for (int i = 0; i < B && i\ - \ < lft; i++) {\n p = mult(p, abs(z - y), x);\n \ - \ z = f(z);\n }\n g = gcd(p, x);\n \ - \ lft -= B;\n }\n if (g == 1) {\n \ - \ y = z;\n len <<= 1;\n continue;\n \ - \ }\n if (g == x) {\n g = 1;\n z =\ - \ zs;\n while(g == 1) {\n g = gcd(abs(z - y),\ - \ x);\n z = f(z);\n }\n }\n \ - \ if (g == x) break;\n assert(g != 1);\n pollard(g,\ + \ (0, r-1)(rng);\n}\n\n#line 1 \"Math/NumberTheory/Pollard_factorize.h\"\n// Copied\ + \ from https://judge.yosupo.jp/submission/61447\n// O(N^0.25)\n//\n// Tested:\n\ + // - (up to 10^18; 200 tests) https://judge.yosupo.jp/problem/factorize\n// -\ + \ https://oj.vnoi.info/problem/icpc21_beta_l\n// - https://www.spoj.com/problems/FACT0/\n\ + //\n// Pollard {{{\nusing ll = long long;\nusing ull = unsigned long long;\nusing\ + \ ld = long double;\nll mult(ll x, ll y, ll md) {\n ull q = (ld)x * y / md;\n\ + \ ll res = ((ull)x * y - q * md);\n if (res >= md) res -= md;\n if (res\ + \ < 0) res += md;\n return res;\n}\n\nll powMod(ll x, ll p, ll md) {\n if\ + \ (p == 0) return 1;\n if (p & 1) return mult(x, powMod(x, p - 1, md), md);\n\ + \ return powMod(mult(x, x, md), p / 2, md);\n}\n\nbool checkMillerRabin(ll\ + \ x, ll md, ll s, int k) {\n x = powMod(x, s, md);\n if (x == 1) return\ + \ true;\n while(k--) {\n if (x == md - 1) return true;\n x =\ + \ mult(x, x, md);\n if (x == 1) return false;\n }\n return false;\n\ + }\nbool isPrime(ll x) {\n if (x == 2 || x == 3 || x == 5 || x == 7) return\ + \ true;\n if (x % 2 == 0 || x % 3 == 0 || x % 5 == 0 || x % 7 == 0) return\ + \ false;\n if (x < 121) return x > 1;\n ll s = x - 1;\n int k = 0;\n\ + \ while(s % 2 == 0) {\n s >>= 1;\n k++;\n }\n if (x < 1LL\ + \ << 32) {\n for (ll z : {2, 7, 61}) {\n if (!checkMillerRabin(z,\ + \ x, s, k)) return false;\n }\n } else {\n for (ll z : {2, 325,\ + \ 9375, 28178, 450775, 9780504, 1795265022}) {\n if (!checkMillerRabin(z,\ + \ x, s, k)) return false;\n }\n }\n return true;\n}\n\nll gcd(ll\ + \ x, ll y) {\n return y == 0 ? x : gcd(y, x % y);\n}\n\nvoid pollard(ll x,\ + \ vector &ans) {\n if (isPrime(x)) {\n ans.push_back(x);\n \ + \ return;\n }\n ll c = 1;\n while(true) {\n c = 1 + get_rand(x\ + \ - 1);\n auto f = [&](ll y) {\n ll res = mult(y, y, x) + c;\n\ + \ if (res >= x) res -= x;\n return res;\n };\n \ + \ ll y = 2;\n int B = 100;\n int len = 1;\n ll g = 1;\n\ + \ while(g == 1) {\n ll z = y;\n for (int i = 0; i\ + \ < len; i++) {\n z = f(z);\n }\n ll zs =\ + \ -1;\n int lft = len;\n while(g == 1 && lft > 0) {\n \ + \ zs = z;\n ll p = 1;\n for (int i\ + \ = 0; i < B && i < lft; i++) {\n p = mult(p, abs(z - y), x);\n\ + \ z = f(z);\n }\n g = gcd(p,\ + \ x);\n lft -= B;\n }\n if (g == 1) {\n \ + \ y = z;\n len <<= 1;\n continue;\n\ + \ }\n if (g == x) {\n g = 1;\n \ + \ z = zs;\n while(g == 1) {\n g = gcd(abs(z\ + \ - y), x);\n z = f(z);\n }\n }\n\ + \ if (g == x) break;\n assert(g != 1);\n pollard(g,\ \ ans);\n pollard(x / g, ans);\n return;\n }\n \ \ }\n}\n// return list of all prime factors of x (can have duplicates)\nvector\ \ factorize(ll x) {\n vector ans;\n for (ll p : {2, 3, 5, 7, 11, 13,\ @@ -83,17 +83,17 @@ data: \ \nusing namespace std;\n\n// for 64-bit, use mt19937_64\nmt19937_64\ \ rng(chrono::steady_clock::now().time_since_epoch().count());\nlong long get_rand(long\ \ long r) {\n return uniform_int_distribution (0, r-1)(rng);\n}\n\ - \n#include \"../NumberTheory/Pollard.h\"\n\nint32_t main() {\n ios::sync_with_stdio(0);\ + \n#include \"../NumberTheory/Pollard_factorize.h\"\n\nint32_t main() {\n ios::sync_with_stdio(0);\ \ cin.tie(0);\n int ntest; cin >> ntest;\n while (ntest--) {\n long\ \ long n; cin >> n;\n auto f = factorize(n);\n cout << f.size();\n\ \ for (auto x : f) cout << ' ' << x;\n cout << '\\n';\n }\n \ \ return 0;\n}\n" dependsOn: - - Math/NumberTheory/Pollard.h + - Math/NumberTheory/Pollard_factorize.h isVerificationFile: true path: Math/tests/factorize.test.cpp requiredBy: [] - timestamp: '2023-02-03 11:07:24+08:00' + timestamp: '2023-10-22 16:42:38+08:00' verificationStatus: TEST_ACCEPTED verifiedWith: [] documentation_of: Math/tests/factorize.test.cpp diff --git a/Math/tests/is_prime_yukicoder.test.cpp.md b/Math/tests/is_prime_yukicoder.test.cpp.md index 4c7d25b8..db5bb189 100644 --- a/Math/tests/is_prime_yukicoder.test.cpp.md +++ b/Math/tests/is_prime_yukicoder.test.cpp.md @@ -2,8 +2,8 @@ data: _extendedDependsOn: - icon: ':heavy_check_mark:' - path: Math/NumberTheory/Pollard.h - title: Math/NumberTheory/Pollard.h + path: Math/NumberTheory/Pollard_factorize.h + title: Math/NumberTheory/Pollard_factorize.h - icon: ':heavy_check_mark:' path: template.h title: template.h @@ -43,10 +43,10 @@ data: \ (0, r-1)(rng);\n}\n\ntemplate\nvector read_vector(int n) {\n\ \ vector res(n);\n for (int& x : res) cin >> x;\n return res;\n}\n\ \nvoid solve();\n\nint main() {\n ios::sync_with_stdio(0); cin.tie(0);\n \ - \ solve();\n return 0;\n}\n#line 1 \"Math/NumberTheory/Pollard.h\"\n// Copied\ - \ from https://judge.yosupo.jp/submission/61447\n// O(N^0.25)\n//\n// Tested:\n\ - // - (up to 10^18; 200 tests) https://judge.yosupo.jp/problem/factorize\n// -\ - \ https://oj.vnoi.info/problem/icpc21_beta_l\n// - https://www.spoj.com/problems/FACT0/\n\ + \ solve();\n return 0;\n}\n#line 1 \"Math/NumberTheory/Pollard_factorize.h\"\ + \n// Copied from https://judge.yosupo.jp/submission/61447\n// O(N^0.25)\n//\n\ + // Tested:\n// - (up to 10^18; 200 tests) https://judge.yosupo.jp/problem/factorize\n\ + // - https://oj.vnoi.info/problem/icpc21_beta_l\n// - https://www.spoj.com/problems/FACT0/\n\ //\n// Pollard {{{\nusing ll = long long;\nusing ull = unsigned long long;\nusing\ \ ld = long double;\nll mult(ll x, ll y, ll md) {\n ull q = (ld)x * y / md;\n\ \ ll res = ((ull)x * y - q * md);\n if (res >= md) res -= md;\n if (res\ @@ -104,16 +104,16 @@ data: \ n;\n cin >> n;\n cout << n << ' ' << isPrime(n) << '\\n';\n \ \ }\n}\n\n" code: "#define PROBLEM \"https://yukicoder.me/problems/no/3030\"\n\n#include \"\ - ../../template.h\"\n#include \"../NumberTheory/Pollard.h\"\n\nvoid solve() {\n\ - \ int q; cin >> q;\n while (q--) {\n long long n;\n cin >>\ - \ n;\n cout << n << ' ' << isPrime(n) << '\\n';\n }\n}\n\n" + ../../template.h\"\n#include \"../NumberTheory/Pollard_factorize.h\"\n\nvoid solve()\ + \ {\n int q; cin >> q;\n while (q--) {\n long long n;\n cin\ + \ >> n;\n cout << n << ' ' << isPrime(n) << '\\n';\n }\n}\n\n" dependsOn: - template.h - - Math/NumberTheory/Pollard.h + - Math/NumberTheory/Pollard_factorize.h isVerificationFile: true path: Math/tests/is_prime_yukicoder.test.cpp requiredBy: [] - timestamp: '2023-02-03 11:07:24+08:00' + timestamp: '2023-10-22 16:42:38+08:00' verificationStatus: TEST_ACCEPTED verifiedWith: [] documentation_of: Math/tests/is_prime_yukicoder.test.cpp diff --git a/Math/tests/yosupo_bigint_add.test.cpp.md b/Math/tests/yosupo_bigint_add.test.cpp.md index c3c3bc6d..b9fe2603 100644 --- a/Math/tests/yosupo_bigint_add.test.cpp.md +++ b/Math/tests/yosupo_bigint_add.test.cpp.md @@ -14,15 +14,15 @@ data: PROBLEM: https://judge.yosupo.jp/problem/addition_of_big_integers links: - https://judge.yosupo.jp/problem/addition_of_big_integers - bundledCode: "Traceback (most recent call last):\n File \"/opt/hostedtoolcache/Python/3.11.5/x64/lib/python3.11/site-packages/onlinejudge_verify/documentation/build.py\"\ + bundledCode: "Traceback (most recent call last):\n File \"/opt/hostedtoolcache/Python/3.11.6/x64/lib/python3.11/site-packages/onlinejudge_verify/documentation/build.py\"\ , line 71, in _render_source_code_stat\n bundled_code = language.bundle(stat.path,\ \ basedir=basedir, options={'include_paths': [basedir]}).decode()\n \ \ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\ - \ File \"/opt/hostedtoolcache/Python/3.11.5/x64/lib/python3.11/site-packages/onlinejudge_verify/languages/cplusplus.py\"\ - , line 187, in bundle\n bundler.update(path)\n File \"/opt/hostedtoolcache/Python/3.11.5/x64/lib/python3.11/site-packages/onlinejudge_verify/languages/cplusplus_bundle.py\"\ + \ File \"/opt/hostedtoolcache/Python/3.11.6/x64/lib/python3.11/site-packages/onlinejudge_verify/languages/cplusplus.py\"\ + , line 187, in bundle\n bundler.update(path)\n File \"/opt/hostedtoolcache/Python/3.11.6/x64/lib/python3.11/site-packages/onlinejudge_verify/languages/cplusplus_bundle.py\"\ , line 401, in update\n self.update(self._resolve(pathlib.Path(included), included_from=path))\n\ \ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n \ - \ File \"/opt/hostedtoolcache/Python/3.11.5/x64/lib/python3.11/site-packages/onlinejudge_verify/languages/cplusplus_bundle.py\"\ + \ File \"/opt/hostedtoolcache/Python/3.11.6/x64/lib/python3.11/site-packages/onlinejudge_verify/languages/cplusplus_bundle.py\"\ , line 260, in _resolve\n raise BundleErrorAt(path, -1, \"no such header\"\ )\nonlinejudge_verify.languages.cplusplus_bundle.BundleErrorAt: bits/stdc++.h:\ \ line -1: no such header\n" diff --git a/Misc/compress.h.md b/Misc/compress.h.md index 6c4ffae8..c66bdbc7 100644 --- a/Misc/compress.h.md +++ b/Misc/compress.h.md @@ -122,14 +122,14 @@ data: isVerificationFile: false path: Misc/compress.h requiredBy: - - DP/count_inversions.h - DP/cnt_distinct_subseq.h + - DP/count_inversions.h - DataStructure/Fenwick/Fenwick2D.h timestamp: '2022-12-22 10:28:54+08:00' verificationStatus: LIBRARY_ALL_AC verifiedWith: - - DP/tests/aizu_alds1_5_d_count_inversions.test.cpp - DP/tests/yosupo_cnt_distinct_subseq.test.cpp + - DP/tests/aizu_alds1_5_d_count_inversions.test.cpp - DataStructure/test/fenwick_2d_pointaddrectsum.test.cpp - DataStructure/test/fenwick_2d_rectsum.test.cpp documentation_of: Misc/compress.h diff --git a/String/SuffixArray.h.md b/String/SuffixArray.h.md index 3c8c1c06..3f5e7cc0 100644 --- a/String/SuffixArray.h.md +++ b/String/SuffixArray.h.md @@ -471,8 +471,8 @@ data: timestamp: '2023-10-15 09:43:20+08:00' verificationStatus: LIBRARY_ALL_AC verifiedWith: - - String/tests/suffix_array.test.cpp - String/tests/lcp.test.cpp + - String/tests/suffix_array.test.cpp - String/tests/suffix_array_queries.test.cpp documentation_of: String/SuffixArray.h layout: document diff --git a/String/hash.h.md b/String/hash.h.md index db638794..f98f995c 100644 --- a/String/hash.h.md +++ b/String/hash.h.md @@ -233,12 +233,12 @@ data: timestamp: '2023-10-15 09:43:20+08:00' verificationStatus: LIBRARY_ALL_AC verifiedWith: - - String/tests/suffix_array.test.cpp - String/tests/lcp.test.cpp - - String/tests/suffix_array_queries.test.cpp - - String/tests/zfunc_hash.test.cpp - - String/tests/aizu_alds_14_b_string_hash.test.cpp - String/tests/yukicoder_1408_string_hash_lcp.test.cpp + - String/tests/aizu_alds_14_b_string_hash.test.cpp + - String/tests/suffix_array.test.cpp + - String/tests/zfunc_hash.test.cpp + - String/tests/suffix_array_queries.test.cpp documentation_of: String/hash.h layout: document redirect_from: diff --git a/buffered_reader.h.md b/buffered_reader.h.md index 832b6fae..b584f00e 100644 --- a/buffered_reader.h.md +++ b/buffered_reader.h.md @@ -86,21 +86,21 @@ data: timestamp: '2022-12-14 02:22:04+08:00' verificationStatus: LIBRARY_ALL_AC verifiedWith: - - Math/tests/matrix_inverse.test.cpp - - Math/tests/matrix_mult.test.cpp - Math/tests/matrix_det.test.cpp - - DataStructure/test/segment_tree_2d_pointaddrectsum.test.cpp - - DataStructure/test/fenwick_pointaddrangesum.test.cpp - - DataStructure/test/wavelet_matrix_rangekthsmallest.test.cpp + - Math/tests/matrix_mult.test.cpp + - Math/tests/matrix_inverse.test.cpp + - DataStructure/test/yosupo_hld_kth_vertex_on_path.test.cpp - DataStructure/test/segment_tree_rangeaffinepointget.test.cpp - - DataStructure/test/hld_lca.test.cpp - - DataStructure/test/segment_tree_pointsetrangecomposite.test.cpp - DataStructure/test/segment_tree_pointaddrangesum.test.cpp + - DataStructure/test/wavelet_matrix_rangekthsmallest.test.cpp + - DataStructure/test/rmq.test.cpp + - DataStructure/test/hld_lca.test.cpp - DataStructure/test/segment_tree_rangeaffinerangesum.test.cpp + - DataStructure/test/segment_tree_pointsetrangecomposite.test.cpp + - DataStructure/test/segment_tree_2d_pointaddrectsum.test.cpp + - DataStructure/test/fenwick_pointaddrangesum.test.cpp - DataStructure/test/lca.test.cpp - - DataStructure/test/rmq.test.cpp - DataStructure/test/fenwick.test.cpp - - DataStructure/test/yosupo_hld_kth_vertex_on_path.test.cpp documentation_of: buffered_reader.h layout: document redirect_from: diff --git a/index.md b/index.md index a21e2eeb..87bf949a 100644 --- a/index.md +++ b/index.md @@ -173,12 +173,12 @@ data: - icon: ':heavy_check_mark:' path: DataStructure/misc/area_of_union_of_rectangles.h title: DataStructure/misc/area_of_union_of_rectangles.h + - icon: ':warning:' + path: DataStructure/misc/ndvec.h + title: DataStructure/misc/ndvec.h - icon: ':warning:' path: DataStructure/misc/offset_vector.h title: DataStructure/misc/offset_vector.h - - icon: ':warning:' - path: DataStructure/misc/vec.h - title: DataStructure/misc/vec.h - name: Geometry pages: - icon: ':warning:' @@ -392,8 +392,8 @@ data: path: Math/NumberTheory/FactorialMod.h title: Math/NumberTheory/FactorialMod.h - icon: ':heavy_check_mark:' - path: Math/NumberTheory/Pollard.h - title: Math/NumberTheory/Pollard.h + path: Math/NumberTheory/Pollard_factorize.h + title: Math/NumberTheory/Pollard_factorize.h - icon: ':warning:' path: Math/NumberTheory/PrimitiveRoot.h title: Math/NumberTheory/PrimitiveRoot.h diff --git a/template.h.md b/template.h.md index e11503aa..7dc97bcb 100644 --- a/template.h.md +++ b/template.h.md @@ -319,94 +319,94 @@ data: isVerificationFile: false path: template.h requiredBy: - - String/lyndon.cpp + - Misc/Die.cpp - String/minmove.cpp - - DP/optimizations/divide_conquer.cpp + - String/lyndon.cpp - DP/optimizations/knuth.cpp - - Misc/Die.cpp + - DP/optimizations/divide_conquer.cpp timestamp: '2022-01-13 13:16:22+08:00' verificationStatus: LIBRARY_ALL_AC verifiedWith: - Graph/tests/aizu_grl_4_a_strongly_connected_cycle_check.test.cpp + - Graph/tests/aizu_grl_2_a_mst.test.cpp - Graph/tests/aizu_grl_3_a_articulation_points.test.cpp - Graph/tests/aizu_grl_1_c_floyd.test.cpp - Graph/tests/aizu_grl_5_a_tree_diameter.test.cpp - - Graph/tests/aizu_grl_2_a_mst.test.cpp - - Math/tests/aizu_ntl_2_e_bigint_mod.test.cpp - - Math/tests/yosupo_primality_rabin_miller.test.cpp - - Math/tests/rabin_miller_32_stress.test.cpp - - Math/tests/smallest_prime_factor_stress.test.cpp - - Math/tests/aizu_ntl_1_e_extended_euclid.test.cpp - - Math/tests/aizu_ntl_1_d_euler_phi.test.cpp - - Math/tests/aizu_ntl_2_a_bigint_add.test.cpp - - Math/tests/aizu_ntl_1_b_modulo_pow.test.cpp - - Math/tests/is_prime_yukicoder.test.cpp - - Math/tests/aizu_ntl_2_d_bigint_div.test.cpp - - Math/tests/aizu_ntl_2_b_bigint_sub.test.cpp - - Math/tests/aizu_ntl_2_c_bigint_mul_karatsuba.test.cpp - - Math/tests/aizu_ntl_1_a_factorize.test.cpp - - Math/tests/aizu_ntl_2_c_bigint_mul.test.cpp - - Math/tests/cnt_divisors_stress.test.cpp - - Math/tests/aizu_ntl_2_f_bigint_mul_fft.test.cpp - - Math/tests/euler_phi_stress.test.cpp - - Geometry/tests/aizu_cgl_4_a_polygon_convex_hull.test.cpp - - Geometry/tests/aizu_cgl_5_a_closest_pair.test.cpp - - Geometry/tests/aizu_cgl_2_b_basic_segment_intersect.test.cpp + - Misc/tests/aizu_dpl_3_b_largest_01_rectangle.test.cpp + - Misc/tests/yosupo_int128.test.cpp + - Misc/tests/aizu_dpl_3_c_largest_histogram.test.cpp - Geometry/tests/z_basic_ccw.test.cpp - - Geometry/tests/aizu_cgl_7_e_circle_circle_intersection.test.cpp - - Geometry/tests/aizu_cgl_4_c_polygon_convex_cut.test.cpp - - Geometry/tests/aizu_cgl_3_b_polygon_is_convex.test.cpp - - Geometry/tests/aizu_cgl_7_g_circle_circle_tangent_points.test.cpp - - Geometry/tests/aizu_cgl_4_b_polygon_convex_diameter.test.cpp - - Geometry/tests/z_polygon_is_convex.test.cpp - - Geometry/tests/aizu_cgl_7_a_cicle_tangents.test.cpp - - Geometry/tests/aizu_cgl_2_d_basic_segment_distance.test.cpp - - Geometry/tests/aizu_cgl_1_a_basic_projection.test.cpp - - Geometry/tests/z_basic_segment_intersect.test.cpp - - Geometry/tests/aizu_cgl_1_b_basic_reflection.test.cpp - - Geometry/tests/aizu_cgl_7_d_circle_line_intersection.test.cpp - Geometry/tests/aizu_cgl_7_f_circle_tangent_points.test.cpp + - Geometry/tests/aizu_cgl_1_b_basic_reflection.test.cpp + - Geometry/tests/polygon_in_convex.test.cpp + - Geometry/tests/z_basic_segment_intersect.test.cpp + - Geometry/tests/aizu_cgl_4_a_polygon_convex_hull.test.cpp + - Geometry/tests/aizu_cgl_7_a_cicle_tangents.test.cpp + - Geometry/tests/aizu_cgl_7_g_circle_circle_tangent_points.test.cpp + - Geometry/tests/aizu_cgl_3_a_polygon_area.test.cpp + - Geometry/tests/z_polygon_convexhull.test.cpp - Geometry/tests/aizu_cgl_2_a_basic_line.test.cpp + - Geometry/tests/aizu_cgl_7_d_circle_line_intersection.test.cpp + - Geometry/tests/aizu_cgl_2_d_basic_segment_distance.test.cpp - Geometry/tests/aizu_cgl_1_c_basic_ccw.test.cpp - - Geometry/tests/z_polygon_convexhull.test.cpp - - Geometry/tests/aizu_cgl_3_a_polygon_area.test.cpp - - Geometry/tests/aizu_cgl_7_i_circle_common_area.test.cpp + - Geometry/tests/aizu_cgl_3_b_polygon_is_convex.test.cpp + - Geometry/tests/aizu_cgl_5_a_closest_pair.test.cpp - Geometry/tests/z_polygon_area.test.cpp + - Geometry/tests/aizu_cgl_4_c_polygon_convex_cut.test.cpp - Geometry/tests/aizu_cgl_3_c_polygon_in_polygon.test.cpp - - Geometry/tests/polygon_in_convex.test.cpp + - Geometry/tests/aizu_cgl_4_b_polygon_convex_diameter.test.cpp + - Geometry/tests/aizu_cgl_1_a_basic_projection.test.cpp + - Geometry/tests/aizu_cgl_7_i_circle_common_area.test.cpp + - Geometry/tests/aizu_cgl_2_b_basic_segment_intersect.test.cpp + - Geometry/tests/z_polygon_is_convex.test.cpp - Geometry/tests/aizu_cgl_2_c_basic_line_intersection.test.cpp - - String/tests/zfunc_hash.test.cpp - - String/tests/aizu_alds_14_b_string_hash.test.cpp + - Geometry/tests/aizu_cgl_7_e_circle_circle_intersection.test.cpp - String/tests/yukicoder_1408_string_hash_lcp.test.cpp - - DP/tests/aizu_dpl_1_d_lis.test.cpp + - String/tests/aizu_alds_14_b_string_hash.test.cpp + - String/tests/zfunc_hash.test.cpp + - Math/tests/aizu_ntl_2_c_bigint_mul_karatsuba.test.cpp + - Math/tests/aizu_ntl_2_a_bigint_add.test.cpp + - Math/tests/aizu_ntl_1_a_factorize.test.cpp + - Math/tests/rabin_miller_32_stress.test.cpp + - Math/tests/aizu_ntl_2_f_bigint_mul_fft.test.cpp + - Math/tests/smallest_prime_factor_stress.test.cpp + - Math/tests/aizu_ntl_2_d_bigint_div.test.cpp + - Math/tests/aizu_ntl_1_d_euler_phi.test.cpp + - Math/tests/yosupo_primality_rabin_miller.test.cpp + - Math/tests/cnt_divisors_stress.test.cpp + - Math/tests/aizu_ntl_2_b_bigint_sub.test.cpp + - Math/tests/euler_phi_stress.test.cpp + - Math/tests/aizu_ntl_2_e_bigint_mod.test.cpp + - Math/tests/aizu_ntl_2_c_bigint_mul.test.cpp + - Math/tests/aizu_ntl_1_b_modulo_pow.test.cpp + - Math/tests/is_prime_yukicoder.test.cpp + - Math/tests/aizu_ntl_1_e_extended_euclid.test.cpp + - DP/tests/yosupo_cnt_distinct_subseq.test.cpp - DP/tests/yosupo_lis.test.cpp - DP/tests/aizu_alds1_5_d_count_inversions.test.cpp - - DP/tests/yosupo_cnt_distinct_subseq.test.cpp - - Misc/tests/yosupo_int128.test.cpp - - Misc/tests/aizu_dpl_3_b_largest_01_rectangle.test.cpp - - Misc/tests/aizu_dpl_3_c_largest_histogram.test.cpp - - DataStructure/test/aizu_dsl_2_d_segment_tree_rangeset.test.cpp - - DataStructure/test/yukicoder_674_range_set.test.cpp - - DataStructure/test/aizu_grl_5_c_hld_lca.test.cpp - - DataStructure/test/aizu_dsl_2_d_rangeset.test.cpp - - DataStructure/test/aizu_dsl_2_h_segment_tree_rangeaddmin.test.cpp - - DataStructure/test/segment_tree_rangeaffinepointget.test.cpp - - DataStructure/test/aizu_dsl_2_g_segment_tree_rangeaddsum.test.cpp - - DataStructure/test/aizu_dsl_2_b_segment_tree_sum.test.cpp + - DP/tests/aizu_dpl_1_d_lis.test.cpp - DataStructure/test/aizu_grl_5_c_lca.test.cpp - - DataStructure/test/persistent_fenwick_tree_rmq.test.cpp - DataStructure/test/binary_trie.test.cpp - - DataStructure/test/mo_algorithm_with_undo.test.cpp - - DataStructure/test/aizu_dsl_2_i_segment_tree_rangesetsum.test.cpp - - DataStructure/test/aizu_dsl_4_a_range_set.test.cpp + - DataStructure/test/aizu_dsl_2_f_segment_tree_rangesetmin.test.cpp + - DataStructure/test/aizu_dsl_2_d_rangeset.test.cpp + - DataStructure/test/aizu_dsl_2_b_segment_tree_sum.test.cpp + - DataStructure/test/aizu_dsl_2_g_segment_tree_rangeaddsum.test.cpp - DataStructure/test/aizu_dsl_2_a_segment_tree_rmq_update.test.cpp - - DataStructure/test/aizu_grl_5_e_hld_edge.test.cpp - - DataStructure/test/aizu_dsl_1_b_dsu_weighted.test.cpp - DataStructure/test/aizu_grl_5_d_hld_edge.test.cpp - - DataStructure/test/aizu_dsl_2_e_segment_tree_rangeadd.test.cpp - - DataStructure/test/aizu_dsl_2_f_segment_tree_rangesetmin.test.cpp - - DataStructure/test/yosupo_rangereversesum_splay.test.cpp + - DataStructure/test/aizu_grl_5_c_hld_lca.test.cpp + - DataStructure/test/segment_tree_rangeaffinepointget.test.cpp + - DataStructure/test/mo_algorithm_with_undo.test.cpp + - DataStructure/test/aizu_grl_5_e_hld_edge.test.cpp - DataStructure/test/mo_algorithm.test.cpp + - DataStructure/test/aizu_dsl_2_d_segment_tree_rangeset.test.cpp + - DataStructure/test/persistent_fenwick_tree_rmq.test.cpp + - DataStructure/test/yosupo_rangereversesum_splay.test.cpp + - DataStructure/test/aizu_dsl_2_e_segment_tree_rangeadd.test.cpp + - DataStructure/test/aizu_dsl_2_h_segment_tree_rangeaddmin.test.cpp + - DataStructure/test/aizu_dsl_1_b_dsu_weighted.test.cpp + - DataStructure/test/yukicoder_674_range_set.test.cpp + - DataStructure/test/aizu_dsl_2_i_segment_tree_rangesetsum.test.cpp + - DataStructure/test/aizu_dsl_4_a_range_set.test.cpp documentation_of: template.h layout: document redirect_from: