結果

問題 No.754 畳み込みの和
ユーザー kpinkcatkpinkcat
提出日時 2023-08-21 21:08:21
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 78 ms / 5,000 ms
コード長 643 bytes
コンパイル時間 1,107 ms
コンパイル使用メモリ 105,044 KB
実行使用メモリ 4,848 KB
最終ジャッジ日時 2023-08-21 21:08:34
合計ジャッジ時間 1,899 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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