Skip to content

Commit dd3116b

Browse files
committed
update Dirichlet mul/inv
1 parent 011c346 commit dd3116b

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

verify/number_theory/dirichlet_inv.test.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
// @brief Dirichlet Inverse and Prefix Sums
22
#define PROBLEM "https://judge.yosupo.jp/problem/dirichlet_inverse_and_prefix_sums"
33
#pragma GCC optimize("Ofast,unroll-loops")
4+
#include <iostream>
5+
#include "blazingio/blazingio.min.hpp"
6+
#include "cp-algo/util/big_alloc.hpp"
47
#include "cp-algo/number_theory/modint.hpp"
58
#include "cp-algo/number_theory/dirichlet.hpp"
69
#include <bits/stdc++.h>
@@ -13,14 +16,11 @@ void solve() {
1316
int64_t n;
1417
cin >> n;
1518
auto [_, m] = floor_stats(n);
16-
vector<base> H(m+1), G(m+1);
19+
cp_algo::big_vector<base> G(m+1);
1720
for (int i = 1; i <= m; ++i) {
1821
cin >> G[i];
1922
}
20-
for (int i = 1; i <= m; ++i) {
21-
H[i] = 1;
22-
}
23-
auto F = Dirichlet_div(H, G, n);
23+
auto F = Dirichlet_div(views::repeat(base(1)), G, n);
2424
for (int i = 1; i <= m; ++i) {
2525
cout << F[i] << " \n"[i == m];
2626
}

verify/number_theory/dirichlet_mul.test.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
// @brief Dirichlet Convolution and Prefix Sums
22
#define PROBLEM "https://judge.yosupo.jp/problem/dirichlet_convolution_and_prefix_sums"
33
#pragma GCC optimize("Ofast,unroll-loops")
4+
#include <iostream>
5+
#include "blazingio/blazingio.min.hpp"
6+
#include "cp-algo/util/big_alloc.hpp"
47
#include "cp-algo/number_theory/modint.hpp"
58
#include "cp-algo/number_theory/dirichlet.hpp"
69
#include <bits/stdc++.h>
@@ -13,7 +16,7 @@ void solve() {
1316
int64_t n;
1417
cin >> n;
1518
auto [_, m] = floor_stats(n);
16-
vector<base> F(m+1), G(m+1);
19+
cp_algo::big_vector<base> F(m+1), G(m+1);
1720
for (int i = 1; i <= m; ++i) {
1821
cin >> F[i];
1922
}

0 commit comments

Comments
 (0)