結果
| 問題 | No.754 畳み込みの和 | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2018-12-02 08:01:54 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 31 ms / 5,000 ms | 
| コード長 | 546 bytes | 
| コンパイル時間 | 633 ms | 
| コンパイル使用メモリ | 76,160 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-06-28 02:33:10 | 
| 合計ジャッジ時間 | 1,225 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 3 | 
ソースコード
#include <cmath>
#include <iostream>
#include <vector>
using namespace std;
using i64 = int64_t;
constexpr int mod = static_cast<int>(powl(10, 9)) + 7;
int main(void) {
  int n; scanf("%d", &n);
  int N = n + 1;
  vector<i64> a(N), b(N);
  for(int i=0; i<N; ++i) { scanf("%ld", &a[i]); }
  for(int i=0; i<N; ++i) { scanf("%ld", &b[i]); }
  for(int i=0; i<N-1; ++i) {
    b[i+1] += b[i];
    b[i+1] %= mod;
  }
  i64 res = 0;
  for(int i=0; i<N; ++i) {
    res += a[i] * b[N-1-i] % mod;
    res %= mod;
  }
  printf("%ld\n", res);
  return 0;
}
            
            
            
        