結果
問題 |
No.3172 三角関数べき乗のフーリエ級数展開
|
ユーザー |
![]() |
提出日時 | 2025-08-01 03:22:44 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 87 ms / 2,000 ms |
コード長 | 1,862 bytes |
コンパイル時間 | 4,570 ms |
コンパイル使用メモリ | 262,076 KB |
実行使用メモリ | 8,424 KB |
最終ジャッジ日時 | 2025-08-01 03:22:51 |
合計ジャッジ時間 | 5,934 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 15 |
ソースコード
#ifndef ONLINE_JUDGE #define _GLIBCXX_DEBUG #endif #include <bits/stdc++.h> #include <cassert> #include <atcoder/all> using namespace std; using namespace atcoder; using ll = long long; using mint = modint998244353; //using mint = modint1000000007; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define repu(i, s, t) for (int i = (int)(s); i < (int)(t); i++) #define repd(i, s, t) for (int i = (int)(s)-1; i >= (int)(t); i--) #define all(v) v.begin(), v.end() void _u() { cerr << endl; } template <class H, class... T> void _u(H&& h, T&&... t) { cerr << h << ", "; _u(move(t)...); } #define U(...) { cerr << #__VA_ARGS__ << ": "; _u(__VA_ARGS__); } template<typename T> bool chmax(T &a, const T b) { if(a >= b) return false; a = b; return true; } template<typename T> bool chmin(T &a, const T b) { if(a <= b) return false; a = b; return true; } template<typename T> istream& operator>>(istream &in, vector<T> &a) { for(T &x: a) in >> x; return in; } template<typename T> ostream& operator<<(ostream &out, const vector<T> &a) { for(const T &x: a) out << x << ' '; return out; } const int di[] = {1, 0, -1, 0, 1, 1, -1, -1, 0}; const int dj[] = {0, 1, 0, -1, -1, 1, 1, -1, 0}; vector<mint> merge(vector<mint> v1, vector<mint> v2) { int n1 = v1.size(), n2 = v2.size(); auto res = convolution(v1, v2); reverse(all(v2)); auto v = convolution(v1, v2); rep(i, n1+n2-1) res[abs(i-(n2-1))] += v[i]; return res; } vector<mint> solve(vector<mint> v, int n) { if(n == 1) return v; auto res = solve(v, n/2); res = merge(res, res); if(n&1) res = merge(res, v); return res; } int main() { int n; cin >> n; if(n == 0) { cout << 1 << endl; return 0; } vector<mint> v = {0, 1}; auto ans = solve(v, n); rep(i, n+1) cout << (ans[i] * 2).val() << " "; cout << endl; return 0; }