結果

問題 No.754 畳み込みの和
ユーザー face4face4
提出日時 2018-12-02 10:02:24
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 77 ms / 5,000 ms
コード長 449 bytes
コンパイル時間 525 ms
コンパイル使用メモリ 65,444 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-10 20:50:28
合計ジャッジ時間 1,427 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include<iostream>
#include<numeric>
using namespace std;

typedef long long ll;

int main(){
    int n;
    cin >> n;
    n++;

    const ll mod = 1e9+7;
    ll a[n], sum = 0;
    for(int i = 0; i < n; i++)  cin >> a[i], sum = (sum+a[i])%mod;

    ll b, ans = 0;
    for(int i = 0; i < n; i++){
        cin >> b;
        b %= mod;
        ans = (ans+b*sum)%mod;
        sum = (sum-a[n-1-i]+mod)%mod;
    }

    cout << ans << endl;

    return 0;
}
0