結果

問題 No.1618 Convolution?
ユーザー hir355hir355
提出日時 2021-07-22 21:41:08
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 407 ms / 2,000 ms
コード長 1,596 bytes
コンパイル時間 4,445 ms
コンパイル使用メモリ 230,116 KB
実行使用メモリ 25,408 KB
最終ジャッジ日時 2023-09-24 16:11:27
合計ジャッジ時間 13,833 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 367 ms
20,772 KB
testcase_03 AC 382 ms
23,836 KB
testcase_04 AC 218 ms
16,916 KB
testcase_05 AC 22 ms
4,376 KB
testcase_06 AC 385 ms
21,824 KB
testcase_07 AC 383 ms
21,788 KB
testcase_08 AC 219 ms
16,936 KB
testcase_09 AC 407 ms
25,248 KB
testcase_10 AC 364 ms
18,832 KB
testcase_11 AC 399 ms
23,948 KB
testcase_12 AC 405 ms
25,408 KB
testcase_13 AC 406 ms
25,328 KB
testcase_14 AC 407 ms
25,236 KB
testcase_15 AC 404 ms
25,332 KB
testcase_16 AC 406 ms
25,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0