結果

問題 No.754 畳み込みの和
ユーザー qumazakiqumazaki
提出日時 2020-10-01 20:29:21
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 118 ms / 5,000 ms
コード長 328 bytes
コンパイル時間 286 ms
コンパイル使用メモリ 87,248 KB
実行使用メモリ 114,596 KB
最終ジャッジ日時 2023-09-21 08:45:57
合計ジャッジ時間 1,383 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n,*ab = map(int,read().split())
a = ab[:n+1]
b = ab[n+1:]
mod = 10**9+7

ans = 0
a_tot = sum(a) % mod
for ai,bi in zip(a[::-1],b):
    ans += a_tot * bi
    ans %= mod
    a_tot -= ai
    a_tot %= mod
print(ans)
0