結果
問題 | No.1618 Convolution? |
ユーザー |
![]() |
提出日時 | 2021-07-22 21:41:08 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 382 ms / 2,000 ms |
コード長 | 1,596 bytes |
コンパイル時間 | 2,871 ms |
コンパイル使用メモリ | 223,992 KB |
最終ジャッジ日時 | 2025-01-23 06:22:23 |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 15 |
ソースコード
#include <atcoder/convolution> #include <bits/stdc++.h> using namespace std; using namespace atcoder; constexpr long long INF_LL = 2000000000000000000LL; constexpr int INF = 2000000000; constexpr long long MOD = 1000000007; #define all(x) x.begin(), x.end() #define REP(i, a, b) for(int i = a; i < b; i++) #define rep(i, n) REP(i, 0, n) typedef long long ll; typedef pair<ll, ll> P; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<P> vp; typedef vector<ll> vl; int dx[4] = {0, -1, 0, 1}; int dy[4] = {1, 0, -1, 0}; int sign[2] = {1, -1}; template <class T> bool chmax(T &a, T b) { if(a < b) { a = b; return 1; } return 0; } template <class T> bool chmin(T &a, T b) { if(a > b) { a = b; return 1; } return 0; } ll modpow(ll a, ll b, ll m) { if(b == 0) return 1; ll t = modpow(a, b / 2, m); if(b & 1) { return (t * t % m) * a % m; } else { return t * t % m; } } struct edge { int to; ll cost; edge(int t, ll c) { to = t, cost = c; } }; typedef vector<vector<int>> graph; //using mint = modint998244353; int main(){ cin.tie(0); std::ios_base::sync_with_stdio(false); std::cout << std::fixed << std::setprecision(16); int n; cin >> n; vl a(n + 1), b(n + 1), f1(n); rep(i, n){ cin >> a[i + 1]; f1[i] = i + 1; } rep(i, n){ cin >> b[i + 1]; } vl c1 = convolution_ll(b, f1); vl c2 = convolution_ll(a, f1); rep(i, n * 2){ cout << c1[i] + c2[i] << " "; } cout << endl; }