結果

問題 No.754 畳み込みの和
ユーザー MayimgMayimg
提出日時 2019-04-02 11:53:01
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 25 ms / 5,000 ms
コード長 541 bytes
コンパイル時間 2,084 ms
コンパイル使用メモリ 201,676 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-08-19 12:34:37
合計ジャッジ時間 2,875 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#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;
}
0