Skip to content

Commit c88f408

Browse files
authored
Merge pull request #194 from hitonanode/modint/rename-val-and-inv-type-change
Modint: val -> val_, val(), inv() update (ACL の modint との互換性向上)
2 parents f7a63ad + 6a3c4ed commit c88f408

23 files changed

+115
-173
lines changed

.verify-helper/timestamps.remote.json

Lines changed: 7 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"combinatorial_opt/test/b_flow.test.cpp": "2022-01-08 20:23:44 +0900",
44
"combinatorial_opt/test/bflow_ns.test.cpp": "2022-05-01 12:19:28 +0900",
55
"combinatorial_opt/test/convex_sum.test.cpp": "2022-01-08 20:23:44 +0900",
6-
"combinatorial_opt/test/linear_matroid_parity.yuki1773.test.cpp": "2022-05-01 02:11:54 +0900",
7-
"combinatorial_opt/test/linear_matroid_parity_size.yuki1773.test.cpp": "2022-05-01 02:11:54 +0900",
6+
"combinatorial_opt/test/linear_matroid_parity.yuki1773.test.cpp": "2022-05-01 16:11:38 +0900",
7+
"combinatorial_opt/test/linear_matroid_parity_size.yuki1773.test.cpp": "2022-05-01 16:11:38 +0900",
88
"combinatorial_opt/test/matroid_intersection.aoj1605.test.cpp": "2022-05-01 15:28:23 +0900",
99
"combinatorial_opt/test/matroid_intersection.aoj_grl_2_b.test.cpp": "2022-05-01 15:28:23 +0900",
1010
"combinatorial_opt/test/maxflow.pushrelabel.test.cpp": "2022-01-08 20:23:44 +0900",
@@ -24,57 +24,34 @@
2424
"combinatorial_opt/test/simplex.shortestpath.test.cpp": "2022-01-08 20:23:44 +0900",
2525
"convex_hull_trick/test/convex_hull_trick.test.cpp": "2020-11-18 20:33:55 +0900",
2626
"convex_hull_trick/test/li_chao_tree.test.cpp": "2021-09-16 00:36:41 +0900",
27-
"convolution/test/bitwise_and_conv.test.cpp": "2022-01-08 20:23:44 +0900",
28-
"convolution/test/bitwise_xor_conv.test.cpp": "2022-01-08 20:23:44 +0900",
27+
"convolution/test/bitwise_and_conv.test.cpp": "2022-05-01 16:11:38 +0900",
28+
"convolution/test/bitwise_xor_conv.test.cpp": "2022-05-01 16:11:38 +0900",
2929
"convolution/test/hadamard_xor.test.cpp": "2022-01-08 20:23:44 +0900",
30-
"convolution/test/multivar_ntt.test.cpp": "2022-01-08 20:23:44 +0900",
31-
"convolution/test/ntt.test.cpp": "2022-01-08 20:23:44 +0900",
32-
"convolution/test/ntt_arbitrary_mod.test.cpp": "2020-11-18 20:06:08 +0900",
30+
"convolution/test/multivar_ntt.test.cpp": "2022-05-01 16:11:38 +0900",
31+
"convolution/test/ntt.test.cpp": "2022-05-01 16:11:38 +0900",
32+
"convolution/test/ntt_arbitrary_mod.test.cpp": "2022-05-01 16:11:38 +0900",
3333
"data_structure/test/assosiative_array.test.cpp": "2022-01-08 20:23:44 +0900",
3434
"data_structure/test/binary_trie.test.cpp": "2021-02-26 23:47:50 +0900",
3535
"data_structure/test/fibonacci_heap_dijkstra.test.cpp": "2022-01-08 20:23:44 +0900",
3636
"data_structure/test/fibonacci_heap_shortestpath.test.cpp": "2022-01-08 20:23:44 +0900",
3737
"data_structure/test/fibonacci_heap_spanningtree.test.cpp": "2022-01-08 20:23:44 +0900",
3838
"data_structure/test/lazy_rbst.stress.test.cpp": "2022-01-08 20:23:44 +0900",
39-
"data_structure/test/lazy_rbst.test.cpp": "2022-01-08 20:23:44 +0900",
4039
"data_structure/test/link_cut_tree.aoj2450.test.cpp": "2022-01-08 20:23:44 +0900",
41-
"data_structure/test/link_cut_tree.composition.test.cpp": "2022-01-08 20:23:44 +0900",
42-
"data_structure/test/link_cut_tree.noncommutative.stress.test.cpp": "2022-05-01 02:11:54 +0900",
4340
"data_structure/test/link_cut_tree.noncommutative2.stress.test.cpp": "2022-01-08 20:23:44 +0900",
44-
"data_structure/test/link_cut_tree.pathadd.stress.test.cpp": "2022-01-08 20:23:44 +0900",
4541
"data_structure/test/link_cut_tree.sum.test.cpp": "2022-01-08 20:23:44 +0900",
4642
"data_structure/test/persistent_queue.test.cpp": "2021-02-26 23:47:50 +0900",
47-
"data_structure/test/queue_operate_all_composite.test.cpp": "2022-05-01 12:00:28 +0900",
4843
"data_structure/test/radix_heap.dijkstra.test.cpp": "2022-01-08 20:23:44 +0900",
4944
"data_structure/test/radix_heap_array.dijkstra.test.cpp": "2022-01-08 20:23:44 +0900",
5045
"data_structure/test/range_kth_smallest_offline.test.cpp": "2022-01-08 20:23:44 +0900",
5146
"data_structure/test/rectange_sum.test.cpp": "2022-01-08 20:23:44 +0900",
5247
"data_structure/test/static_range_inversion.test.cpp": "2022-01-08 20:23:44 +0900",
53-
"formal_power_series/test/bernoulli_number.test.cpp": "2020-11-18 20:06:08 +0900",
5448
"formal_power_series/test/coeff_of_rational_function.test.cpp": "2022-01-08 20:23:44 +0900",
55-
"formal_power_series/test/division_number.test.cpp": "2020-11-18 20:06:08 +0900",
56-
"formal_power_series/test/factorial_power.stirling_number_of_2nd.test.cpp": "2022-01-08 20:23:44 +0900",
57-
"formal_power_series/test/fps_exp.test.cpp": "2020-11-18 20:06:08 +0900",
58-
"formal_power_series/test/fps_exp_modintruntime.test.cpp": "2021-06-06 14:54:00 +0900",
59-
"formal_power_series/test/fps_inv.test.cpp": "2020-11-18 20:06:08 +0900",
60-
"formal_power_series/test/fps_log.test.cpp": "2020-11-18 20:06:08 +0900",
6149
"formal_power_series/test/fps_pow.test.cpp": "2020-11-18 20:06:08 +0900",
6250
"formal_power_series/test/fps_pow_another.test.cpp": "2020-12-02 23:28:27 +0900",
63-
"formal_power_series/test/fps_sqrt.test.cpp": "2022-01-08 20:23:44 +0900",
64-
"formal_power_series/test/fps_sqrt_modintruntime.test.cpp": "2021-06-06 14:54:00 +0900",
65-
"formal_power_series/test/kitamasa.test.cpp": "2022-01-08 20:23:44 +0900",
66-
"formal_power_series/test/kth_term_of_linearly_recurrent_sequence.test.cpp": "2022-01-08 20:23:44 +0900",
67-
"formal_power_series/test/linear_recurrence.test.cpp": "2022-01-08 20:23:44 +0900",
6851
"formal_power_series/test/multipoint_evaluation.test.cpp": "2022-05-01 12:00:28 +0900",
6952
"formal_power_series/test/poly_taylor_shift.test.cpp": "2020-11-18 20:06:08 +0900",
70-
"formal_power_series/test/polynomial_divmod.test.cpp": "2022-01-08 20:23:44 +0900",
71-
"formal_power_series/test/polynomial_interpolation.test.cpp": "2022-05-01 12:00:28 +0900",
7253
"formal_power_series/test/sharp_p_subset_sum.test.cpp": "2020-11-18 20:06:08 +0900",
73-
"formal_power_series/test/shift_of_sampling_points.test.cpp": "2022-01-08 20:23:44 +0900",
74-
"formal_power_series/test/stirling_number_of_1st.test.cpp": "2022-05-01 12:00:28 +0900",
7554
"formal_power_series/test/stirling_number_of_2nd.test.cpp": "2020-11-18 20:06:08 +0900",
76-
"formal_power_series/test/sum_of_exponential_times_polynomial.test.cpp": "2022-01-08 20:23:44 +0900",
77-
"formal_power_series/test/sum_of_exponential_times_polynomial_limit.test.cpp": "2022-05-01 12:00:28 +0900",
7855
"geometry/test/circumcenter.test.cpp": "2022-01-08 20:23:44 +0900",
7956
"geometry/test/convex_cut.test.cpp": "2022-01-08 20:23:44 +0900",
8057
"geometry/test/convex_hull.test.cpp": "2022-01-08 20:23:44 +0900",
@@ -85,7 +62,6 @@
8562
"graph/test/bipartite_matching(slow).test.cpp": "2020-11-21 18:08:42 +0900",
8663
"graph/test/bipartite_matching.test.cpp": "2021-11-03 21:38:41 +0900",
8764
"graph/test/bridge.test.cpp": "2022-01-08 20:23:44 +0900",
88-
"graph/test/chromatic_number.test.cpp": "2022-05-01 12:00:28 +0900",
8965
"graph/test/cycle_detection_directed.test.cpp": "2022-01-08 20:23:44 +0900",
9066
"graph/test/directed_mst.aoj.test.cpp": "2022-01-08 20:23:44 +0900",
9167
"graph/test/dulmage_mendelsohn.yuki1615.test.cpp": "2022-01-08 20:23:44 +0900",
@@ -108,27 +84,14 @@
10884
"graph/test/two-edge-connected-components.test.cpp": "2022-01-08 20:23:44 +0900",
10985
"graph/test/warshallfloyd.test.cpp": "2022-05-01 15:28:23 +0900",
11086
"graph/test/zero_one_bfs.yuki1695.test.cpp": "2022-05-01 15:28:23 +0900",
111-
"linear_algebra_matrix/test/blackbox_matrix_stress.test.cpp": "2022-05-01 02:11:54 +0900",
112-
"linear_algebra_matrix/test/characteristic_poly.test.cpp": "2022-05-01 02:11:54 +0900",
113-
"linear_algebra_matrix/test/det_of_blackbox_matrix.test.cpp": "2022-01-08 20:23:44 +0900",
114-
"linear_algebra_matrix/test/hafnian.test.cpp": "2022-01-08 20:23:44 +0900",
115-
"linear_algebra_matrix/test/hessenberg_system.stress.test.cpp": "2022-04-30 23:36:43 +0900",
116-
"linear_algebra_matrix/test/inverse_matrix.test.cpp": "2022-05-01 02:11:54 +0900",
11787
"linear_algebra_matrix/test/linalg_aclmodint_determinant.test.cpp": "2022-05-01 02:11:54 +0900",
11888
"linear_algebra_matrix/test/linalg_bitset.test.cpp": "2022-01-08 20:23:44 +0900",
11989
"linear_algebra_matrix/test/linalg_ll_det.test.cpp": "2022-01-08 20:23:44 +0900",
12090
"linear_algebra_matrix/test/linalg_longlong.test.cpp": "2022-01-08 20:23:44 +0900",
12191
"linear_algebra_matrix/test/linalg_longlong_matmul.test.cpp": "2022-01-08 20:23:44 +0900",
12292
"linear_algebra_matrix/test/linalg_min_plus_semiring.yuki1780.test.cpp": "2022-05-01 02:11:54 +0900",
123-
"linear_algebra_matrix/test/linalg_modint_determinant.test.cpp": "2022-05-01 02:11:54 +0900",
124-
"linear_algebra_matrix/test/linalg_modint_multiplication.test.cpp": "2022-05-01 02:11:54 +0900",
125-
"linear_algebra_matrix/test/linalg_modint_pow.test.cpp": "2022-05-01 02:11:54 +0900",
12693
"linear_algebra_matrix/test/linalg_semirings.yuki1340.test.cpp": "2022-05-01 02:11:54 +0900",
127-
"linear_algebra_matrix/test/matrix_det_dual_number.yuki1303.test.cpp": "2022-05-01 02:11:54 +0900",
128-
"linear_algebra_matrix/test/matrix_product.test.cpp": "2022-05-01 02:11:54 +0900",
12994
"linear_algebra_matrix/test/matrix_rank.yuki1773.test.cpp": "2022-05-01 02:11:54 +0900",
130-
"linear_algebra_matrix/test/system_of_linear_equations.test.cpp": "2022-05-01 03:07:24 +0900",
131-
"number/test/arithmetic_function_totient.test.cpp": "2022-01-08 20:23:44 +0900",
13295
"number/test/binary_gcd.stress.test.cpp": "2021-08-21 15:46:09 +0900",
13396
"number/test/bs_sieve.test.cpp": "2022-01-08 20:23:44 +0900",
13497
"number/test/combination.stress.test.cpp": "2021-10-30 11:40:58 +0900",
@@ -138,25 +101,14 @@
138101
"number/test/enumerate_primes.test.cpp": "2022-01-08 20:23:44 +0900",
139102
"number/test/factorize_aoj.test.cpp": "2022-01-08 20:23:44 +0900",
140103
"number/test/factorize_longlong.test.cpp": "2022-01-08 20:23:44 +0900",
141-
"number/test/gcd_convolution.test.cpp": "2022-02-10 02:28:06 +0900",
142104
"number/test/gen_primes.test.cpp": "2021-10-30 11:24:11 +0900",
143-
"number/test/lcm_convolution.test.cpp": "2022-02-10 02:28:06 +0900",
144105
"number/test/miller-rabin-5e7.test.cpp": "2022-01-08 20:23:44 +0900",
145106
"number/test/miller-rabin.test.cpp": "2022-01-08 20:23:44 +0900",
146107
"number/test/min_max_semiring.test.cpp": "2022-01-25 23:19:52 +0900",
147-
"number/test/montmort_number_mod.test.cpp": "2022-01-08 20:23:44 +0900",
148-
"number/test/multiple_moebius.yuki1627.test.cpp": "2022-01-29 16:38:30 +0900",
149-
"number/test/multiple_moebius.yuki886.test.cpp": "2022-01-29 16:38:30 +0900",
150108
"number/test/nimber.test.cpp": "2021-10-27 23:41:07 +0900",
151109
"number/test/prime_factorization.test.cpp": "2021-10-30 11:24:11 +0900",
152-
"number/test/primitive_root.test.cpp": "2022-01-08 20:23:44 +0900",
153-
"number/test/sieve.stress.test.cpp": "2022-01-08 20:23:44 +0900",
154-
"number/test/sqrt_modint_runtime.test.cpp": "2021-06-06 17:00:00 +0900",
155-
"number/test/zeta_moebius_transform.test.cpp": "2022-01-29 16:38:30 +0900",
156110
"other_algorithms/test/enumerate_triangles.test.cpp": "2022-01-08 20:23:44 +0900",
157-
"other_algorithms/test/permutation_tree.yuki1720.test.cpp": "2022-01-08 20:23:44 +0900",
158111
"other_algorithms/test/slope_trick_stress.test.cpp": "2022-01-08 20:23:44 +0900",
159-
"segmenttree/test/acl_range-affine-range-sum.test.cpp": "2022-01-08 20:23:44 +0900",
160112
"segmenttree/test/acl_rmq.test.cpp": "2022-01-08 20:23:44 +0900",
161113
"segmenttree/test/acl_rsq.test.cpp": "2022-01-08 20:23:44 +0900",
162114
"segmenttree/test/beats.test.cpp": "2022-01-08 20:23:44 +0900",
@@ -166,20 +118,14 @@
166118
"segmenttree/test/countandsumlessthan.test.cpp": "2022-01-08 20:23:44 +0900",
167119
"segmenttree/test/merge_sort_tree.aoj2426.test.cpp": "2022-01-08 20:23:44 +0900",
168120
"segmenttree/test/point-add-range-sum.test.cpp": "2021-11-06 11:36:55 +0900",
169-
"segmenttree/test/point-set-range-composite.test.cpp": "2022-01-08 20:23:44 +0900",
170121
"segmenttree/test/point-update-range-min.test.cpp": "2022-01-08 20:23:44 +0900",
171-
"segmenttree/test/range-affine-range-sum.test.cpp": "2022-01-08 20:23:44 +0900",
172122
"segmenttree/test/rangetree.test.cpp": "2022-01-08 20:23:44 +0900",
173123
"segmenttree/test/rangetree.yuki1625.test.cpp": "2022-01-08 20:23:44 +0900",
174124
"segmenttree/test/rangetree_bit.test.cpp": "2022-01-08 20:23:44 +0900",
175125
"segmenttree/test/rmq_nonrecursive.test.cpp": "2022-01-08 20:23:44 +0900",
176126
"segmenttree/test/segment_tree_2d.test.cpp": "2022-01-08 20:23:44 +0900",
177127
"segmenttree/test/segment_tree_2d_pointadd.test.cpp": "2022-01-08 20:23:44 +0900",
178128
"set_power_series/test/subset_conv.test.cpp": "2021-10-16 14:40:57 +0900",
179-
"set_power_series/test/subset_exp.stress.test.cpp": "2022-01-08 20:23:44 +0900",
180-
"set_power_series/test/subset_log.test.cpp": "2022-01-08 20:23:44 +0900",
181-
"set_power_series/test/subset_pow.stress.test.cpp": "2022-01-08 20:23:44 +0900",
182-
"set_power_series/test/subset_pow.yuki1594.test.cpp": "2022-01-08 20:23:44 +0900",
183129
"sparse_table/test/disjoint_sparse_table_rmq.test.cpp": "2021-11-02 23:36:31 +0900",
184130
"sparse_table/test/disjoint_sparse_table_rsq.test.cpp": "2021-11-02 23:36:31 +0900",
185131
"sparse_table/test/sparse_table.test.cpp": "2022-01-08 20:23:44 +0900",
@@ -195,7 +141,6 @@
195141
"string/test/manacher_mp.test.cpp": "2022-01-08 20:23:44 +0900",
196142
"string/test/rolling_hash.test.cpp": "2022-01-08 20:23:44 +0900",
197143
"string/test/rolling_hash_lcp.test.cpp": "2022-01-08 20:23:44 +0900",
198-
"string/test/rolling_hash_w_modint.test.cpp": "2022-01-08 20:23:44 +0900",
199144
"string/test/run_enumerate_lyndon_hash.test.cpp": "2022-01-08 20:23:44 +0900",
200145
"string/test/run_enumerate_lyndon_rmq.test.cpp": "2022-01-08 20:23:44 +0900",
201146
"string/test/sa_count_keyword.reader.test.cpp": "2022-01-08 20:23:44 +0900",
@@ -204,19 +149,15 @@
204149
"string/test/z_algorithm.test.cpp": "2021-01-01 16:52:32 +0900",
205150
"tree/test/cartesian_tree.test.cpp": "2021-10-13 23:08:08 +0900",
206151
"tree/test/diameter.test.cpp": "2021-06-09 00:31:07 +0900",
207-
"tree/test/frequency_table_of_tree_distance.stress.test.cpp": "2022-05-01 15:28:23 +0900",
208152
"tree/test/frequency_table_of_tree_distance.test.cpp": "2022-01-08 20:23:44 +0900",
209-
"tree/test/frequency_table_of_tree_distance_ntt.test.cpp": "2022-01-08 20:23:44 +0900",
210153
"tree/test/hl_decomposition.test.cpp": "2022-01-08 20:23:44 +0900",
211154
"tree/test/lca.test.cpp": "2021-07-30 23:28:45 +0900",
212155
"tree/test/lca.yuki898.test.cpp": "2021-07-30 23:28:45 +0900",
213156
"tree/test/lca_rmq.test.cpp": "2022-01-08 20:23:44 +0900",
214157
"tree/test/rerooting.aoj1595.test.cpp": "2021-10-23 00:38:09 +0900",
215158
"tree/test/rerooting.yuki1718.test.cpp": "2021-10-23 00:38:09 +0900",
216-
"tree/test/tree_isomorphism.aoj1613.test.cpp": "2022-01-08 20:23:44 +0900",
217159
"tree/test/vertex-add-path-sum.test.cpp": "2022-01-08 20:23:44 +0900",
218160
"tree/test/vertex-add-subtree-sum.test.cpp": "2022-01-08 20:23:44 +0900",
219-
"tree/test/vertex-set-path-composite.test.cpp": "2022-01-08 20:23:44 +0900",
220161
"unionfind/test/fully_persistent_uf.test.cpp": "2022-01-08 20:23:44 +0900",
221162
"unionfind/test/unionfind.test.cpp": "2022-04-30 19:41:44 +0900",
222163
"unionfind/test/unionfind_rankbased.test.cpp": "2021-01-01 16:52:32 +0900",
@@ -226,6 +167,5 @@
226167
"utilities/test/floor_sum.test.cpp": "2022-01-08 20:23:44 +0900",
227168
"utilities/test/integer_segments.test.cpp": "2021-04-25 18:25:53 +0900",
228169
"utilities/test/kth_root_integer.test.cpp": "2021-05-01 20:55:29 +0900",
229-
"utilities/test/pow.test.cpp": "2022-01-08 20:23:44 +0900",
230170
"utilities/test/predecessor_problem.test.cpp": "2021-04-25 18:25:53 +0900"
231171
}

convolution/fft_arbitrary_mod.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,14 @@ std::vector<MODINT> convolution_mod(std::vector<MODINT> a, std::vector<MODINT> b
6969
int sz = 1 << nbase;
7070
std::vector<cmplx> fa(sz);
7171
for (int i = 0; i < (int)a.size(); i++)
72-
fa[i] = {(T_FFT)(a[i].val & ((1LL << D_FFT) - 1)), (T_FFT)(a[i].val >> D_FFT)};
72+
fa[i] = {(T_FFT)(a[i].val() & ((1LL << D_FFT) - 1)), (T_FFT)(a[i].val() >> D_FFT)};
7373
fft(sz, fa);
7474
std::vector<cmplx> fb(sz);
7575
if (a == b)
7676
fb = fa;
7777
else {
7878
for (int i = 0; i < (int)b.size(); i++)
79-
fb[i] = {(T_FFT)(b[i].val & ((1LL << D_FFT) - 1)), (T_FFT)(b[i].val >> D_FFT)};
79+
fb[i] = {(T_FFT)(b[i].val() & ((1LL << D_FFT) - 1)), (T_FFT)(b[i].val() >> D_FFT)};
8080
fft(sz, fb);
8181
}
8282
T_FFT ratio = 0.25L / sz;
@@ -101,13 +101,13 @@ std::vector<MODINT> convolution_mod(std::vector<MODINT> a, std::vector<MODINT> b
101101
fft(sz, fa);
102102
fft(sz, fb);
103103
std::vector<MODINT> ret(sz);
104-
long long bp = MODINT(2).pow(D_FFT).val;
105-
long long cp = MODINT(2).pow(D_FFT * 2).val;
104+
long long bp = MODINT(2).pow(D_FFT).val();
105+
long long cp = MODINT(2).pow(D_FFT * 2).val();
106106
for (int i = 0; i < need; i++) {
107107
long long aa = llround(fa[i].x);
108108
long long bb = llround(fb[i].x);
109109
long long cc = llround(fa[i].y);
110-
aa = MODINT(aa).val, bb = MODINT(bb).val, cc = MODINT(cc).val;
110+
aa = MODINT(aa).val(), bb = MODINT(bb).val(), cc = MODINT(cc).val();
111111
ret[i] = aa + (bb * bp) + (cc * cp);
112112
// ret[i] = aa + (bb << DFFT) + (cc << (DFFT * 2));
113113
}

convolution/ntt.hpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ template <typename MODINT> void ntt(std::vector<MODINT> &a, bool is_inverse = fa
5454
}
5555
}
5656
}
57-
int n_inv = MODINT(n).inv();
57+
int n_inv = MODINT(n).inv().val();
5858
for (auto &v : a) v *= n_inv;
5959
}
6060
}
@@ -76,12 +76,12 @@ std::vector<ModInt<MOD>> nttconv_(const std::vector<int> &a, const std::vector<i
7676
long long garner_ntt_(int r0, int r1, int r2, int mod) {
7777
using mint2 = ModInt<nttprimes[2]>;
7878
static const long long m01 = 1LL * nttprimes[0] * nttprimes[1];
79-
static const long long m0_inv_m1 = ModInt<nttprimes[1]>(nttprimes[0]).inv();
80-
static const long long m01_inv_m2 = mint2(m01).inv();
79+
static const long long m0_inv_m1 = ModInt<nttprimes[1]>(nttprimes[0]).inv().val();
80+
static const long long m01_inv_m2 = mint2(m01).inv().val();
8181

8282
int v1 = (m0_inv_m1 * (r1 + nttprimes[1] - r0)) % nttprimes[1];
8383
auto v2 = (mint2(r2) - r0 - mint2(nttprimes[0]) * v1) * m01_inv_m2;
84-
return (r0 + 1LL * nttprimes[0] * v1 + m01 % mod * v2.val) % mod;
84+
return (r0 + 1LL * nttprimes[0] * v1 + m01 % mod * v2.val()) % mod;
8585
}
8686
template <typename MODINT>
8787
std::vector<MODINT> nttconv(std::vector<MODINT> a, std::vector<MODINT> b, bool skip_garner) {
@@ -110,14 +110,14 @@ std::vector<MODINT> nttconv(std::vector<MODINT> a, std::vector<MODINT> b, bool s
110110
a.resize(n + m - 1);
111111
} else {
112112
std::vector<int> ai(sz), bi(sz);
113-
for (int i = 0; i < n; i++) ai[i] = a[i].val;
114-
for (int i = 0; i < m; i++) bi[i] = b[i].val;
113+
for (int i = 0; i < n; i++) ai[i] = a[i].val();
114+
for (int i = 0; i < m; i++) bi[i] = b[i].val();
115115
auto ntt0 = nttconv_<nttprimes[0]>(ai, bi);
116116
auto ntt1 = nttconv_<nttprimes[1]>(ai, bi);
117117
auto ntt2 = nttconv_<nttprimes[2]>(ai, bi);
118118
a.resize(n + m - 1);
119119
for (int i = 0; i < n + m - 1; i++)
120-
a[i] = garner_ntt_(ntt0[i].val, ntt1[i].val, ntt2[i].val, mod);
120+
a[i] = garner_ntt_(ntt0[i].val(), ntt1[i].val(), ntt2[i].val(), mod);
121121
}
122122
return a;
123123
}

convolution/test/ntt.test.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#define PROBLEM "https://judge.yosupo.jp/problem/convolution_mod"
2+
#include "../ntt.hpp"
23
#include "../../modint.hpp"
34
#include "../../number/modint_runtime.hpp"
4-
#include "../ntt.hpp"
55
#include <iostream>
66
using namespace std;
77

@@ -17,14 +17,14 @@ int main() {
1717
cin >> N >> M;
1818
vector<mint> A(N), B(M);
1919
vector<mintr> Ar(N), Br(M);
20-
for (int i = 0; i < N; i++) cin >> A[i], Ar[i] = A[i].val;
21-
for (int i = 0; i < M; i++) cin >> B[i], Br[i] = B[i].val;
20+
for (int i = 0; i < N; i++) cin >> A[i], Ar[i] = A[i].val();
21+
for (int i = 0; i < M; i++) cin >> B[i], Br[i] = B[i].val();
2222

2323
vector<mint> ret = nttconv(A, B);
2424
vector<mintr> retr = nttconv(Ar, Br);
2525

2626
for (int i = 0; i < N + M - 1; i++) {
27-
assert(ret[i].val == retr[i].val);
27+
assert(ret[i].val() == retr[i].val());
2828
cout << ret[i] << ' ';
2929
}
3030
cout << '\n';

convolution/test/ntt_arbitrary_mod.test.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ int main() {
1717
cin >> N >> M;
1818
vector<mint> A(N), B(M);
1919
vector<mintr> Ar(N), Br(M);
20-
for (int i = 0; i < N; i++) cin >> A[i], Ar[i] = A[i].val;
21-
for (int i = 0; i < M; i++) cin >> B[i], Br[i] = B[i].val;
20+
for (int i = 0; i < N; i++) cin >> A[i], Ar[i] = A[i].val();
21+
for (int i = 0; i < M; i++) cin >> B[i], Br[i] = B[i].val();
2222

2323
vector<mint> ret = nttconv(A, B);
2424
vector<mintr> retr = nttconv(Ar, Br);
2525

2626
for (int i = 0; i < N + M - 1; i++) {
27-
assert(ret[i].val == retr[i].val);
28-
cout << ret[i].val << ' ';
27+
assert(ret[i].val() == retr[i].val());
28+
cout << ret[i].val() << ' ';
2929
}
3030
}

data_structure/test/queue_operate_all_composite.test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ int main() {
2424
mint x;
2525
cin >> x;
2626
pair<mint, mint> f = swag.fold_all();
27-
cout << (f.first * x + f.second).val << '\n';
27+
cout << (f.first * x + f.second).val() << '\n';
2828
}
2929
}
3030
}

0 commit comments

Comments
 (0)