結果
問題 | No.754 畳み込みの和 |
ユーザー |
![]() |
提出日時 | 2020-03-14 11:13:21 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 97 ms / 5,000 ms |
コード長 | 514 bytes |
コンパイル時間 | 1,977 ms |
コンパイル使用メモリ | 196,164 KB |
最終ジャッジ日時 | 2025-01-09 06:46:49 |
ジャッジサーバーID (参考情報) |
judge2 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 3 |
ソースコード
#include <bits/stdc++.h>using namespace std;int main() {constexpr int64_t mod = 1000000007;int n;cin >> n;vector<int64_t> a(n + 1), b(n + 1), s(n + 2);for (int i = 0; i <= n; i++) cin >> a.at(i);for (int i = 0; i <= n; i++) cin >> b.at(i);for (int i = 0; i <= n; i++) {s.at(i + 1) = (s.at(i) + a.at(i)) % mod;}int64_t ans = 0;for (int i = 0; i <= n; i++) {ans += s.at(i + 1) * b.at(n - i);ans %= mod;}cout << ans << endl;}