結果

問題 No.754 畳み込みの和
ユーザー pyttknpyttkn
提出日時 2018-12-06 11:44:19
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 27 ms / 5,000 ms
コード長 811 bytes
コンパイル時間 3,080 ms
コンパイル使用メモリ 82,760 KB
実行使用メモリ 4,772 KB
最終ジャッジ日時 2023-10-12 02:37:22
合計ジャッジ時間 1,335 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#define _USE_MATH_DEFINES
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<string>
#include<iomanip>
#include<cassert>
#include<functional>

int main(){
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);

	const long long subtract = 1000000007;
	long long n;
	long long temp_b;
	long long temp_b_sum = 0;
	long long ans = 0;

	std::cin >> n;

	std::vector<long long> a(n + 1);
	std::vector<long long> b_sum(n + 1);

	for (long long i = 0; i < n + 1; i++){
		std::cin >> a[i];
	}
	for (long long i = 0; i < n + 1; i++){
		std::cin >> temp_b;
		temp_b_sum += temp_b;
		temp_b_sum %= subtract;
		b_sum[i] = temp_b_sum;
	}
	//入力終わり

	for (long long i = 0; i < n + 1; i++){
		ans += a[i] * b_sum[n - i];
		ans = ans % subtract;
	}

	std::cout << ans << '\n';

	return 0;
}
0