結果
| 問題 |
No.754 畳み込みの和
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-12-10 01:21:25 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 32 ms / 5,000 ms |
| コード長 | 592 bytes |
| コンパイル時間 | 2,203 ms |
| コンパイル使用メモリ | 195,112 KB |
| 最終ジャッジ日時 | 2025-01-06 18:47:58 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 3 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
const int M = int(1e9 + 7);
signed main() {
ios::sync_with_stdio(false);
int N;
cin >> N;
vector<int> A(N + 1);
for (int i = 0; i < N + 1; ++i) cin >> A[i];
vector<int> B(N + 1);
for (int i = 0; i < N + 1; ++i) cin >> B[i];
vector<int> bsum(N + 2);
partial_sum(B.begin(), B.end(), bsum.begin() + 1,
[](int s, int x) { return (s + x) % M; });
int ans = 0;
for (int i = 0; i < N + 1; ++i)
(ans += 1LL * A[i] * bsum[N + 1 - i] % M) %= M;
if (ans < 0) ans += M;
cout << ans << endl;
return 0;
}