結果

問題 No.1618 Convolution?
ユーザー brthyyjpbrthyyjp
提出日時 2021-07-25 18:27:39
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 238 ms / 2,000 ms
コード長 459 bytes
コンパイル時間 279 ms
コンパイル使用メモリ 87,268 KB
実行使用メモリ 132,616 KB
最終ジャッジ日時 2023-09-28 08:22:10
合計ジャッジ時間 10,130 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,320 KB
testcase_01 AC 72 ms
71,300 KB
testcase_02 AC 191 ms
114,796 KB
testcase_03 AC 205 ms
125,356 KB
testcase_04 AC 184 ms
110,904 KB
testcase_05 AC 95 ms
78,620 KB
testcase_06 AC 207 ms
120,988 KB
testcase_07 AC 210 ms
121,228 KB
testcase_08 AC 185 ms
111,304 KB
testcase_09 AC 235 ms
131,264 KB
testcase_10 AC 195 ms
115,320 KB
testcase_11 AC 230 ms
129,912 KB
testcase_12 AC 234 ms
132,616 KB
testcase_13 AC 236 ms
131,364 KB
testcase_14 AC 233 ms
132,172 KB
testcase_15 AC 230 ms
131,688 KB
testcase_16 AC 238 ms
132,220 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = [0]*(2*n+1)
add = 0
cum = 0
for i in range(1, 2*n):
    if i <= n:
        add += A[i-1]
    else:
        add -= A[i-n-1]
        cum -= n*A[i-n-1]
    cum += add
    C[i+1] += cum
add = 0
cum = 0
for i in range(1, 2*n):
    if i <= n:
        add += B[i-1]
    else:
        add -= B[i-n-1]
        cum -= n*B[i-n-1]
    cum += add
    C[i+1] += cum
print(*C[1:])
0