結果

問題 No.754 畳み込みの和
ユーザー kpinkcat
提出日時 2023-08-21 21:08:21
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 90 ms / 5,000 ms
コード長 643 bytes
コンパイル時間 1,087 ms
コンパイル使用メモリ 102,700 KB
最終ジャッジ日時 2025-02-16 12:06:52
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<map>
#include<vector>
#include <algorithm>
#include<math.h>
#include <iomanip>
#include<set>
#include <numeric>
using namespace std;


int main()
{
    long long n, mod, ans = 0, ad = 0, bd = 0;
    cin >> n;
    mod = 1e9+7;
    vector<long long> a(n+1), b(n+1);
    
    for (long long i = 0; i < n+1; i++){
        cin >> a[i];
        ad += a[i];
        ad %= mod;
    }
    for (long long i = 0; i < n+1; i++) cin >> b[i];
    for (long long i = 0; i < n+1; i++){
        ans += (ad * b[i])%mod;
        ans %= mod;
        ad += mod;
        ad -= a[n-i];
        ad %= mod;
    }
    cout << ans << endl;
}
0