結果

問題 No.1618 Convolution?
ユーザー keijakkeijak
提出日時 2021-07-23 18:55:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 257 ms / 2,000 ms
コード長 429 bytes
コンパイル時間 1,350 ms
コンパイル使用メモリ 86,980 KB
実行使用メモリ 134,028 KB
最終ジャッジ日時 2023-09-25 17:42:24
合計ジャッジ時間 10,726 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,208 KB
testcase_01 AC 72 ms
71,144 KB
testcase_02 AC 228 ms
115,484 KB
testcase_03 AC 204 ms
126,264 KB
testcase_04 AC 181 ms
113,772 KB
testcase_05 AC 93 ms
78,672 KB
testcase_06 AC 206 ms
122,080 KB
testcase_07 AC 209 ms
122,176 KB
testcase_08 AC 183 ms
114,384 KB
testcase_09 AC 247 ms
132,788 KB
testcase_10 AC 243 ms
118,616 KB
testcase_11 AC 225 ms
131,332 KB
testcase_12 AC 243 ms
134,028 KB
testcase_13 AC 257 ms
133,232 KB
testcase_14 AC 234 ms
133,300 KB
testcase_15 AC 245 ms
133,364 KB
testcase_16 AC 246 ms
133,896 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

ca = [0]* (n+1)
for i in range(n):
    ca[i+1] = ca[i] + a[i] + b[i]


c = [0] * (2*n + 1)
for k in range(2, 2*n + 1):
    s = c[k-1]
    e = k - (n+1)
    s += ca[min(k-1, n)] - ca[max(e,0)]
    #for j in range(max(e,0), min(k-1, n)):
        #s += a[j] + b[j]
    if e >= 1:
        s -= n * (a[e-1] + b[e-1])
    c[k] = s

print(*c[1:])
0