結果

問題 No.754 畳み込みの和
ユーザー potoooooooopotoooooooo
提出日時 2018-12-16 21:46:36
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 82 ms / 5,000 ms
コード長 507 bytes
コンパイル時間 1,780 ms
コンパイル使用メモリ 169,164 KB
実行使用メモリ 4,824 KB
最終ジャッジ日時 2023-10-25 22:21:38
合計ジャッジ時間 2,838 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 82 ms
4,824 KB
testcase_01 AC 82 ms
4,824 KB
testcase_02 AC 81 ms
4,824 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#define mod 1000000007

int main() {
    int n; cin >> n;
    vector<long long> a(n+1, 0), b(n+1, 0);
    for (int i = 0; i <= n; ++i) {
        cin >> a[i];
    }
    for (int i = 0; i <= n; ++i) {
        cin >> b[i];
        if (i > 0) {
            b[i] += b[i-1]; b[i] %= mod;
        }
    }
    long long ans = 0;
    for (int i = 0; i <= n; ++i) {
        ans += (a[i] * b[n-i]) % mod;
        ans %= mod;
    }
    cout << ans << endl;
    return 0;
}
0