結果

問題 No.1618 Convolution?
ユーザー AEnAEn
提出日時 2022-11-28 22:43:26
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 255 ms / 2,000 ms
コード長 473 bytes
コンパイル時間 238 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 181,688 KB
最終ジャッジ日時 2024-04-15 20:06:55
合計ジャッジ時間 8,771 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
51,840 KB
testcase_01 AC 39 ms
52,096 KB
testcase_02 AC 201 ms
149,788 KB
testcase_03 AC 223 ms
164,112 KB
testcase_04 AC 184 ms
135,844 KB
testcase_05 AC 72 ms
77,440 KB
testcase_06 AC 220 ms
161,972 KB
testcase_07 AC 226 ms
161,796 KB
testcase_08 AC 185 ms
136,908 KB
testcase_09 AC 255 ms
180,908 KB
testcase_10 AC 201 ms
143,244 KB
testcase_11 AC 249 ms
176,772 KB
testcase_12 AC 249 ms
181,688 KB
testcase_13 AC 247 ms
180,780 KB
testcase_14 AC 253 ms
181,576 KB
testcase_15 AC 247 ms
180,668 KB
testcase_16 AC 245 ms
181,444 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