結果

問題 No.754 畳み込みの和
ユーザー gazellegazelle
提出日時 2018-12-02 00:17:13
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 27 ms / 5,000 ms
コード長 1,134 bytes
コンパイル時間 1,139 ms
コンパイル使用メモリ 122,928 KB
実行使用メモリ 5,564 KB
最終ジャッジ日時 2023-09-09 10:14:28
合計ジャッジ時間 1,743 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
5,428 KB
testcase_01 AC 27 ms
5,564 KB
testcase_02 AC 27 ms
5,360 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}

/* --------------------------------------- */
0