結果
| 問題 | No.754 畳み込みの和 | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2019-04-02 11:53:01 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 28 ms / 5,000 ms | 
| コード長 | 541 bytes | 
| コンパイル時間 | 2,397 ms | 
| コンパイル使用メモリ | 197,196 KB | 
| 最終ジャッジ日時 | 2025-01-07 01:17:00 | 
| ジャッジサーバーID (参考情報) | judge2 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 3 | 
ソースコード
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  const int mod = 1e9 + 7;
  int n;
  cin >> n;
  n++;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  vector<long long> b(n + 1);
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    b[i + 1] = b[i] + x;
    b[i + 1] %= mod;
  }
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    ans += (b[n - i] * a[i]) % mod;
    ans %= mod;
  }
  cout << ans << endl;
  return 0;
}
            
            
            
        