結果
| 問題 |
No.754 畳み込みの和
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-12-02 15:53:08 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 26 ms / 5,000 ms |
| コード長 | 932 bytes |
| コンパイル時間 | 1,621 ms |
| コンパイル使用メモリ | 168,588 KB |
| 実行使用メモリ | 5,632 KB |
| 最終ジャッジ日時 | 2024-07-01 05:20:07 |
| 合計ジャッジ時間 | 2,116 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 3 |
ソースコード
#include <bits/stdc++.h>
#define FOR(v, a, b) for(int v = (a); v < (b); ++v)
#define FORE(v, a, b) for(int v = (a); v <= (b); ++v)
#define REP(v, n) FOR(v, 0, n)
#define REPE(v, n) FORE(v, 0, n)
#define REV(v, a, b) for(int v = (a); v >= (b); --v)
#define ALL(x) (x).begin(), (x).end()
#define LLI long long int
using namespace std;
template <typename T> using V = vector<T>;
template <typename T, typename U> using P = pair<T,U>;
template <typename I> void join(ostream &ost, I s, I t, string d=" "){for(auto i=s; i!=t; ++i){if(i!=s)ost<<d; ost<<*i;}ost<<endl;}
const LLI mod = 1e9+7;
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
int n; cin >> n;
vector<LLI> a(n+1), b(n+1);
REPE(i,n) cin >> a[i];
REPE(i,n) cin >> b[i];
vector<LLI> bsum(n+1, b[0]);
FORE(i,1,n) (bsum[i] = bsum[i-1] + b[i]) %= mod;
LLI ans = 0;
REPE(i,n) (ans += a[i] * bsum[n-i]) %= mod;
cout << ans << endl;
return 0;
}