結果

問題 No.754 畳み込みの和
ユーザー polyomino_24polyomino_24
提出日時 2018-12-06 03:12:34
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 78 ms / 5,000 ms
コード長 927 bytes
コンパイル時間 740 ms
コンパイル使用メモリ 99,596 KB
実行使用メモリ 4,760 KB
最終ジャッジ日時 2023-10-11 14:51:26
合計ジャッジ時間 1,672 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define show(x) cout << #x << " = " << (x) << endl;
using namespace std;
using ll = long long;
using pii = pair<int,int>;
int main(){
    int n;
    cin >> n;
    ll mod = 1e9+7;
    n++;
    vector<ll>a(n);
    vector<ll>b(n+1,0);
    rep(i,n)cin >> a[i];
    rep(i,n)cin >> b[i];
    rep(i,n)b[i+1] += b[i];
    rep(i,n)b[i+1]%=mod;
    ll ans = 0;
    rep(i,n){
        ans += a[i] * b[n-1-i];
        ans %= mod;
    }
    cout << ans << endl;
}
0