結果

問題 No.754 畳み込みの和
ユーザー a01sa01to
提出日時 2024-10-29 00:43:46
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 83 ms / 5,000 ms
コード長 601 bytes
コンパイル時間 3,251 ms
コンパイル使用メモリ 249,380 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-29 00:43:50
合計ジャッジ時間 4,446 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
  #include "settings/debug.cpp"
#else
  #define Debug(...) void(0)
#endif
#define rep(i, n) for (int i = 0; i < (n); ++i)
using ll = long long;
using ull = unsigned long long;

#include <atcoder/modint>
using mint = atcoder::modint1000000007;

int main() {
  int n;
  cin >> n;
  vector<int> a(n + 1), b(n + 1);
  rep(i, n + 1) cin >> a[i];
  rep(i, n + 1) cin >> b[i];
  mint ans = 0, sum = accumulate(a.begin(), a.end(), mint(0));
  rep(i, n + 1) {
    ans += sum * b[i];
    sum -= a[n - i];
  }
  cout << ans.val() << endl;
  return 0;
}
0