結果

問題 No.754 畳み込みの和
コンテスト
ユーザー yansi819
提出日時 2024-03-29 11:40:11
言語 C++17
(gcc 15.2.0 + boost 1.90.0)
コンパイル:
g++-15 -O2 -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 53 ms / 5,000 ms
コード長 587 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,834 ms
コンパイル使用メモリ 277,268 KB
実行使用メモリ 9,972 KB
最終ジャッジ日時 2026-07-04 07:03:14
合計ジャッジ時間 4,097 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 3
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
using ld = long double;

int main() {
  int n; cin >> n;
  vector<int> a(n + 1), b(n + 1);
  vector<ll> sum(n + 1);
  for (int i = 0; i < n + 1; i++) cin >> a[i];
  for (int i = 0; i < n + 1; i++) cin >> b[i];
  sum[0] = a[0];
  for (int i = 1; i < n + 1; i++) sum[i] = (sum[i - 1] + a[i]) % 1'000'000'007;
  ll ans = 0;
  for (int i = 0; i < n + 1; i++) {
    ans += (sum[n - i] * b[i]) % 1'000'000'007;
    ans %= 1'000'000'007;
  }
  cout << ans << endl;
  return 0;
}
0