結果
| 問題 | No.754 畳み込みの和 | 
| コンテスト | |
| ユーザー |  Rubikun | 
| 提出日時 | 2019-07-30 23:29:43 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 69 ms / 5,000 ms | 
| コード長 | 548 bytes | 
| コンパイル時間 | 1,448 ms | 
| コンパイル使用メモリ | 170,124 KB | 
| 実行使用メモリ | 6,944 KB | 
| 最終ジャッジ日時 | 2024-07-05 06:16:27 | 
| 合計ジャッジ時間 | 2,531 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 3 | 
ソースコード
#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;
}
            
            
            
        