結果

問題 No.754 畳み込みの和
ユーザー yuppe19 😺yuppe19 😺
提出日時 2018-12-02 07:59:20
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 521 bytes
コンパイル時間 577 ms
コンパイル使用メモリ 72,224 KB
実行使用メモリ 4,744 KB
最終ジャッジ日時 2023-09-10 11:06:41
合計ジャッジ時間 1,273 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

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