結果

問題 No.754 畳み込みの和
ユーザー nebukuro09nebukuro09
提出日時 2018-12-02 00:07:19
言語 D
(dmd 2.106.1)
結果
WA  
実行時間 -
コード長 565 bytes
コンパイル時間 679 ms
コンパイル使用メモリ 104,432 KB
実行使用メモリ 6,416 KB
最終ジャッジ日時 2023-09-03 21:16:33
合計ジャッジ時間 1,587 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, std.bitmanip;

immutable long MOD = 10^^9 + 7;

void main() {
    auto N = readln.chomp.to!int;
    auto A = (N+1).iota.map!(_ => readln.chomp.to!long).array;
    auto B = (N+1).iota.map!(_ => readln.chomp.to!long).array;

    auto b = B.sum;
    long ans = 0;

    foreach (i; 0..N+1) {
        ans += A[i] * b % MOD;
        ans %= MOD;
        b -= B[N-i];
    }

    ans.writeln;
}
0