結果

問題 No.754 畳み込みの和
ユーザー RubikunRubikun
提出日時 2019-07-30 23:29:43
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 78 ms / 5,000 ms
コード長 548 bytes
コンパイル時間 1,578 ms
コンパイル使用メモリ 167,600 KB
実行使用メモリ 5,432 KB
最終ジャッジ日時 2023-09-18 15:44:58
合計ジャッジ時間 2,492 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=100001,INF=1<<30;

int main(){

    int N;cin>>N;
    vector<ll> A(N+1),B(N+1),S(N+1,0);
    for(int i=0;i<N+1;i++){
        cin>>A[i];
    }
    for(int i=0;i<N+1;i++){
        cin>>B[i];
        if(i) S[i]=(S[i-1]+B[i])%mod;
        else S[i]=B[i];
    }
    
    ll ans=0;
    
    for(int i=0;i<N+1;i++){
        ans+=A[i]*S[N-i];
        ans=ans%mod;
    }
    
    cout<<ans<<endl;
}
0