結果

問題 No.754 畳み込みの和
ユーザー m_tsubasam_tsubasa
提出日時 2018-12-03 15:30:30
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 77 ms / 5,000 ms
コード長 506 bytes
コンパイル時間 1,400 ms
コンパイル使用メモリ 164,672 KB
実行使用メモリ 4,956 KB
最終ジャッジ日時 2023-09-13 21:09:11
合計ジャッジ時間 2,203 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
#define N 1000000007
using namespace std;

long long n;
long long a[100005] = {0};
long long b[100005] = {0};

long long solve();

int main() {
  cin >> n;
  for(int i = 0; i <= n; ++i) cin >> a[i];
  for(int i = 0; i <= n; ++i) {
    cin >> b[i];
    if(i != 0) b[i] += b[i - 1];
    b[i] %= N;
  }

  cout << solve() << endl;
  return 0;
}

long long solve() {
  long long ans = 0;
  for(int i = 0; i <= n; ++i) {
    ans += a[i] * b[n - i] % N;
    ans %= N;
  }
  return ans;
}
0