結果

問題 No.754 畳み込みの和
ユーザー finefine
提出日時 2018-12-12 18:29:57
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 24 ms / 5,000 ms
コード長 520 bytes
コンパイル時間 1,449 ms
コンパイル使用メモリ 169,240 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-25 08:31:49
合計ジャッジ時間 2,409 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

using ll = long long;

const ll MOD = 1000000007;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<ll> a(n + 1);
    ll s = 0;
    for (int i = 0; i <= n; i++) {
        cin >> a[i];
        (s += a[i]) %= MOD;
    }

    ll ans = 0;
    for (int i = 0; i <= n; i++) {
        ll x;
        cin >> x;
        (ans += x * s % MOD) %= MOD;
        (s += MOD - a[n - i]) %= MOD;
    }
    cout << ans << endl;
    return 0;
}
0