結果
| 問題 | No.754 畳み込みの和 | 
| コンテスト | |
| ユーザー |  gazelle | 
| 提出日時 | 2018-12-02 00:17:13 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 28 ms / 5,000 ms | 
| コード長 | 1,134 bytes | 
| コンパイル時間 | 1,207 ms | 
| コンパイル使用メモリ | 119,700 KB | 
| 最終ジャッジ日時 | 2025-01-06 17:50:11 | 
| ジャッジサーバーID (参考情報) | judge2 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 3 | 
ソースコード
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<unordered_map>
#include<queue>
#include<iomanip>
#include<math.h>
#include<bitset>
#include<cassert>
#include<random>
#include<time.h>
using namespace std;
using ll=long long;
using ld=long double;
using P=pair<int,int>;
#define MOD 1000000007LL
#define INF 1000000000LL
#define EPS 1e-10
#define FOR(i,n,m) for(ll i=n;i<(ll)m;i++)
#define REP(i,n) FOR(i,0,n)
#define DUMP(a) REP(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";else cout<<endl;}
#define ALL(v) v.begin(),v.end()
#define UNIQUE(v)  sort(ALL(v));v.erase(unique(ALL(v)),v.end());
#define pb push_back
/* --------------------------------------- */
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n;
	cin >> n;
	vector<ll> a(n + 1), b(n + 1);
	REP(i,n + 1) cin >> a[i];
	REP(i,n + 1) cin >> b[i];
	vector<ll> acm(n + 1);
	acm[0] = b[0];
	FOR(i, 1, n + 1) {
		acm[i] = acm[i - 1] + b[i];
		acm[i] %= MOD;
	}
	ll ans = 0;
	REP(i,n + 1) {
		ans += a[i] * acm[n - i];
		ans %= MOD;
	}
	cout << ans << endl;
	return 0;
}
/* --------------------------------------- */
            
            
            
        