結果

問題 No.754 畳み込みの和
ユーザー Shibuyap
提出日時 2020-07-21 20:57:27
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 103 ms / 5,000 ms
コード長 596 bytes
コンパイル時間 2,295 ms
コンパイル使用メモリ 193,436 KB
最終ジャッジ日時 2025-01-12 01:33:10
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
#define MAX_N 200005

int main() {
    ll n;
    cin >> n;
    ll a[n+1], b[n+1];
    rep(i,n+1)cin >> a[i];
    rep(i,n+1)cin >> b[i];
    ll MOD = 1000000007;

    ll ans = 0;
    ll sum = 0;
    drep(i,n+1){
        sum += b[n-i];
        sum %= MOD;
        ans += a[i] * sum;
        ans %= MOD;
    }
    cout << ans << endl;   
    return 0;
}
 
 
0