結果

問題 No.754 畳み込みの和
ユーザー 👑 obakyanobakyan
提出日時 2019-04-27 22:22:48
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 76 ms / 5,000 ms
コード長 622 bytes
コンパイル時間 701 ms
コンパイル使用メモリ 73,196 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-19 22:27:20
合計ジャッジ時間 1,409 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <cstdio>
#include <cstdlib>
#include <cstddef>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <iostream>
#include <iomanip>
#define L64 long long
#define MOD (1000000007LL)

int main(void)
{
  L64 n;
  std::cin >> n;
  std::vector<L64> asum;
  asum.resize(n + 2);
  L64 tmp;
  std::cin >> tmp;
  asum[1] = tmp;
  for(L64 i = 2; i <= n + 1; i++){
    std::cin >> tmp;
    asum[i] = (asum[i - 1] + tmp) % MOD;
  }
  L64 sum = 0;
  for(L64 i = 1; i <= n + 1; i++){
    std::cin >> tmp;
    sum = (sum + (tmp * asum[n + 2 - i]) % MOD) % MOD;
  }
  std::cout << sum << std::endl;
}
0