結果
| 問題 | No.754 畳み込みの和 | 
| コンテスト | |
| ユーザー |  mag | 
| 提出日時 | 2020-07-15 22:37:21 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 27 ms / 5,000 ms | 
| コード長 | 496 bytes | 
| コンパイル時間 | 1,726 ms | 
| コンパイル使用メモリ | 166,612 KB | 
| 実行使用メモリ | 5,888 KB | 
| 最終ジャッジ日時 | 2024-11-22 14:52:05 | 
| 合計ジャッジ時間 | 2,850 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 3 | 
ソースコード
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep2(i, a, n) for(int i = (a); i < (n); i++)
#define rep(i, n) rep2(i,0,n)
#define mod 1000000007
int main(){
  cin.tie(nullptr);ios_base::sync_with_stdio(false);
  int n;cin>>n;
  n++;
  ll a[n],b[n],pref[n];
  rep(i,n)cin>>a[i];
  rep(i,n)cin>>b[i];
  rep(i,n){
    pref[i]=b[i];
    if(i)pref[i]=(pref[i]+pref[i-1])%mod;
  }
  ll ans=0;
  rep(i,n){
    ans+=a[i]*pref[n-1-i]%mod;
    ans%=mod;
  }
  cout<<ans<<endl;
}
            
            
            
        