結果

問題 No.754 畳み込みの和
ユーザー CleyLCleyL
提出日時 2020-02-27 15:15:37
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 530 bytes
コンパイル時間 681 ms
コンパイル使用メモリ 70,372 KB
実行使用メモリ 5,548 KB
最終ジャッジ日時 2023-08-03 18:51:30
合計ジャッジ時間 1,648 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

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

ソースコード

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]);
    }
    ll ans = 0;
    for(int i = 0; n >= i; i++){
        ans = (ans+A[i]*b[n+1-i])%MOD;
    }
    cout << ans << endl;
}
0