Skip to content

Commit 8af7cf6

Browse files
committed
conversion to newton basis
1 parent ece2fed commit 8af7cf6

File tree

3 files changed

+35
-3
lines changed

3 files changed

+35
-3
lines changed

verify/poly/inv.test.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
// @brief Inv of Power Series
22
#define PROBLEM "https://judge.yosupo.jp/problem/inv_of_formal_power_series"
33
#pragma GCC optimize("Ofast,unroll-loops")
4-
#include "cp-algo/math/poly.hpp"
54
#include <bits/stdc++.h>
5+
#include "blazingio/blazingio.min.hpp"
6+
#include "cp-algo/math/poly.hpp"
67

78
using namespace std;
89
using namespace cp_algo::math;
@@ -15,7 +16,7 @@ void solve() {
1516
int n;
1617
cin >> n;
1718
polyn::Vector a(n);
18-
copy_n(istream_iterator<base>(cin), n, begin(a));
19+
for(auto &it: a) {cin >> it;}
1920
polyn(a).inv_inplace(n).print(n);
2021
}
2122

verify/poly/newton.test.cpp

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// @brief Conversion to Newton Basis
2+
#define PROBLEM "https://judge.yosupo.jp/problem/conversion_from_monomial_basis_to_newton_basis"
3+
#pragma GCC optimize("Ofast,unroll-loops")
4+
#include "cp-algo/math/poly.hpp"
5+
#include <bits/stdc++.h>
6+
7+
using namespace std;
8+
using namespace cp_algo::math;
9+
10+
const int mod = 998244353;
11+
using base = modint<mod>;
12+
using polyn = poly_t<base>;
13+
14+
void solve() {
15+
int n;
16+
cin >> n;
17+
polyn::Vector a(n), p(n);
18+
copy_n(istream_iterator<base>(cin), n, begin(a));
19+
copy_n(istream_iterator<base>(cin), n, begin(p));
20+
polyn(a).to_newton(p).print(n);
21+
}
22+
23+
signed main() {
24+
//freopen("input.txt", "r", stdin);
25+
ios::sync_with_stdio(0);
26+
cin.tie(0);
27+
int t;
28+
t = 1;// cin >> t;
29+
while(t--) {
30+
solve();
31+
}
32+
}

verify/poly/taylor.test.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// @brief Polynomial Taylor Shift
22
#define PROBLEM "https://judge.yosupo.jp/problem/polynomial_taylor_shift"
33
#pragma GCC optimize("Ofast,unroll-loops")
4-
#pragma GCC target("tune=native")
54
#include "cp-algo/math/poly.hpp"
65
#include <bits/stdc++.h>
76

0 commit comments

Comments
 (0)