結果

問題 No.1618 Convolution?
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2021-07-23 23:24:45
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 249 ms / 2,000 ms
コード長 461 bytes
コンパイル時間 293 ms
コンパイル使用メモリ 87,004 KB
実行使用メモリ 135,484 KB
最終ジャッジ日時 2023-09-26 01:57:34
合計ジャッジ時間 8,768 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,268 KB
testcase_01 AC 75 ms
71,348 KB
testcase_02 AC 199 ms
117,008 KB
testcase_03 AC 220 ms
128,164 KB
testcase_04 AC 187 ms
112,860 KB
testcase_05 AC 101 ms
78,804 KB
testcase_06 AC 215 ms
123,300 KB
testcase_07 AC 215 ms
123,292 KB
testcase_08 AC 189 ms
113,060 KB
testcase_09 AC 249 ms
134,360 KB
testcase_10 AC 203 ms
117,500 KB
testcase_11 AC 237 ms
132,684 KB
testcase_12 AC 243 ms
135,484 KB
testcase_13 AC 239 ms
134,500 KB
testcase_14 AC 238 ms
135,144 KB
testcase_15 AC 241 ms
134,588 KB
testcase_16 AC 243 ms
135,172 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

print(*C[:-1])
0