結果

問題 No.754 畳み込みの和
ユーザー iicafiaxusiicafiaxus
提出日時 2018-12-02 17:49:11
言語 D
(dmd 2.107.1)
結果
AC  
実行時間 118 ms / 5,000 ms
コード長 598 bytes
コンパイル時間 820 ms
コンパイル使用メモリ 112,336 KB
実行使用メモリ 14,088 KB
最終ジャッジ日時 2023-09-03 21:17:21
合計ジャッジ時間 1,740 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

import std.stdio, std.conv, std.string, std.bigint;
import std.math, std.random, std.datetime;
import std.array, std.range, std.algorithm, std.container;
string read(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }

const long mod = 1_000_000_007;

void main(){
	int n = read.to!int;
	long[] as, bs;
	foreach(i; 0 .. n + 1) as ~= read.to!long;
	foreach(i; 0 .. n + 1) bs ~= read.to!long;
	
	long ans = 0;
	long sum = 0;
	foreach(i; 0 .. n + 1){
		sum += as[i];
		sum %= mod;
		ans += sum * bs[n - i];
		ans %= mod;
	}
	ans.writeln;
}
0