結果

問題 No.754 畳み込みの和
コンテスト
ユーザー t33f
提出日時 2018-12-06 19:11:51
言語 C++11
(gcc 15.3.0 + boost 1.92.0)
コンパイル:
g++-15 -O2 -fplugin=/usr/lib/yukicoder/noavx512-gcc15.so -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 57 ms / 5,000 ms
+ 781µs
コード長 442 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 339 ms
コンパイル使用メモリ 72,504 KB
実行使用メモリ 9,820 KB
最終ジャッジ日時 2026-10-15 09:56:52
合計ジャッジ時間 1,732 ms
ジャッジサーバーID
(参考情報)
judge5_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 4
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <iostream>
using namespace std;

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