結果
| 問題 | No.754 畳み込みの和 | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2018-12-02 10:02:24 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 81 ms / 5,000 ms | 
| コード長 | 449 bytes | 
| コンパイル時間 | 522 ms | 
| コンパイル使用メモリ | 66,356 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-06-28 11:56:17 | 
| 合計ジャッジ時間 | 1,637 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 3 | 
ソースコード
#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;
}
            
            
            
        