結果

問題 No.754 畳み込みの和
ユーザー CleyLCleyL
提出日時 2020-02-27 15:16:40
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 85 ms / 5,000 ms
コード長 534 bytes
コンパイル時間 571 ms
コンパイル使用メモリ 69,784 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-21 17:00:13
合計ジャッジ時間 1,387 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <vector>
using namespace std;
using ll = long long;
const ll MOD = 1000000007;
int main(){
    int n;cin>>n;
    vector<ll> A(n+1);
    vector<ll> B(n+1);
    for(int i = 0; n >= i; i++){
        cin>>A[i];
    }
    for(int i = 0; n >= i; i++){
        cin>>B[i];
    }
    vector<ll> b(n+2);
    b[0] = 0;
    for(int i = 1; n+1 >= i; i++){
        b[i] = (b[i-1]+B[i-1])%MOD;
    }
    ll ans = 0;
    for(int i = 0; n >= i; i++){
        ans = (ans+A[i]*b[n+1-i])%MOD;
    }
    cout << ans << endl;
}
0