結果

問題 No.754 畳み込みの和
コンテスト
ユーザー ミドリムシ
提出日時 2018-12-02 08:03:36
言語 C++11
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 53 ms / 5,000 ms
コード長 498 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 400 ms
コンパイル使用メモリ 76,988 KB
実行使用メモリ 6,144 KB
最終ジャッジ日時 2026-03-16 12:28:55
合計ジャッジ時間 1,156 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 3
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int main(){
    int n;
    cin >> n;
    n++;
    long a_sum = 0;
    long a_sums[n];
    for(int i = 0; i < n; i++){
        long a;
        cin >> a;
        a_sum = (a + a_sum) % long(1e9 + 7);
        a_sums[i] = a_sum;
    }
    long ans = 0;
    for(int i = 0; i < n; i++){
        long b;
        cin >> b;
        ans += a_sums[n - i - 1] * b % long(1e9 + 7);
    }
    cout << ans % long(1e9 + 7) << endl;
}
0