結果
問題 | No.754 畳み込みの和 |
ユーザー |
|
提出日時 | 2019-09-18 16:18:04 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 73 ms / 5,000 ms |
コード長 | 645 bytes |
コンパイル時間 | 1,410 ms |
コンパイル使用メモリ | 171,132 KB |
実行使用メモリ | 6,940 KB |
最終ジャッジ日時 | 2024-07-08 09:27:40 |
合計ジャッジ時間 | 2,473 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 3 |
ソースコード
#include <bits/stdc++.h>#define rep(i, n) for(int i = 0; i < (int)(n); i++)#define all(x) (x).begin(),(x).end()#define rall(x) (x).rbegin(),(x).rend()#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );using namespace std;using ll = long long;const ll Mod = 1e9 + 7;int main(){int n;cin >> n;n++;vector<ll> a(n+1), b(n+1);rep(i, n) cin >> a[i];rep(i, n){ll tmp;cin >> tmp;b[i+1] += tmp + b[i];b[i+1] %= Mod;}reverse(all(b));ll ans = 0;rep(i, n){ans += (a[i] * b[i]) % Mod;ans %= Mod;}cout << ans << endl;}