結果

問題 No.754 畳み込みの和
ユーザー tonyu0tonyu0
提出日時 2020-08-01 17:31:01
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 78 ms / 5,000 ms
コード長 657 bytes
コンパイル時間 696 ms
コンパイル使用メモリ 87,512 KB
実行使用メモリ 4,580 KB
最終ジャッジ日時 2023-09-22 11:08:26
合計ジャッジ時間 1,748 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <algorithm>
#include <iomanip>
#include <iostream>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;
#define rep(i, j, n) for (int i = j; i < (int)n; ++i)
#define rrep(i, j, n) for (int i = (int)n - 1; j <= i; --i)

constexpr ll MOD = 1000000007;
constexpr int INF = 0x3f3f3f3f;
constexpr ll INFL = 0x3f3f3f3f3f3f3f3fLL;

int main() {
  int n;
  cin >> n;
  vector<ll> a(n + 1), b(n + 1);
  rep(i, 0, n + 1) cin >> a[i];
  rep(i, 0, n + 1) cin >> b[i];
  rep(i, 0, n)(b[i + 1] += b[i]) %= MOD;

  ll ans = 0;
  rep(i, 0, n + 1)(ans += a[i] * b[n - i] % MOD) %= MOD;

  cout << ans << endl;

  return 0;
}
0