結果

問題 No.1618 Convolution?
ユーザー AEnAEn
提出日時 2022-11-28 22:43:26
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 288 ms / 2,000 ms
コード長 473 bytes
コンパイル時間 980 ms
コンパイル使用メモリ 86,948 KB
実行使用メモリ 175,344 KB
最終ジャッジ日時 2023-07-28 11:25:31
合計ジャッジ時間 13,137 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,344 KB
testcase_01 AC 76 ms
71,312 KB
testcase_02 AC 251 ms
153,180 KB
testcase_03 AC 288 ms
168,912 KB
testcase_04 AC 224 ms
140,848 KB
testcase_05 AC 99 ms
78,912 KB
testcase_06 AC 244 ms
159,728 KB
testcase_07 AC 244 ms
159,920 KB
testcase_08 AC 215 ms
141,596 KB
testcase_09 AC 288 ms
174,980 KB
testcase_10 AC 235 ms
147,552 KB
testcase_11 AC 275 ms
173,800 KB
testcase_12 AC 288 ms
175,344 KB
testcase_13 AC 283 ms
174,740 KB
testcase_14 AC 278 ms
175,084 KB
testcase_15 AC 282 ms
174,832 KB
testcase_16 AC 278 ms
175,320 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N =int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

sm_a, sm_b = [0], [0]
for i in range(N):
    sm_a.append(sm_a[-1]+A[i])
    sm_b.append(sm_b[-1]+B[i])

resa, resb = 0, 0
C = [0]
for i in range(2*N-1):
    if i<N:
        resa += sm_a[i+1]
        resb += sm_b[i+1]
    else:
        resa -= N*A[i-N]
        resb -= N*B[i-N]
        resa += sm_a[-1]-sm_a[i-N+1]
        resb += sm_b[-1]-sm_b[i-N+1]
    C.append(resa+resb)
print(*C)
0