結果

問題 No.754 畳み込みの和
ユーザー SSRSSSRS
提出日時 2020-11-26 06:56:17
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 81 ms / 5,000 ms
コード長 514 bytes
コンパイル時間 673 ms
コンパイル使用メモリ 70,068 KB
実行使用メモリ 5,460 KB
最終ジャッジ日時 2023-10-01 03:13:08
合計ジャッジ時間 1,526 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <vector>
using namespace std;
const long long MOD = 1000000007;
int main(){
	int n;
	cin >> n;
	vector<long long> a(n + 1);
	for (int i = 0; i <= n; i++){
		cin >> a[i];
	}
	vector<long long> b(n + 1);
	for (int i = 0; i <= n; i++){
		cin >> b[i];
	}
	vector<long long> S(n + 2);
	S[0] = 0;
	for (int i = 0; i <= n; i++){
		S[i + 1] = (S[i] + b[i]) % MOD;
	}
	long long ans = 0;
	for (int i = 0; i <= n; i++){
		ans += a[i] * S[n + 1 - i] % MOD;
	}
	ans %= MOD;
	cout << ans << endl;
}
0