結果

問題 No.1618 Convolution?
ユーザー lloyzlloyz
提出日時 2022-09-21 00:05:23
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 703 ms / 2,000 ms
コード長 477 bytes
コンパイル時間 354 ms
コンパイル使用メモリ 10,932 KB
実行使用メモリ 74,900 KB
最終ジャッジ日時 2023-08-23 19:44:21
合計ジャッジ時間 15,063 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,876 KB
testcase_01 AC 16 ms
7,896 KB
testcase_02 AC 480 ms
43,856 KB
testcase_03 AC 550 ms
53,480 KB
testcase_04 AC 441 ms
48,060 KB
testcase_05 AC 47 ms
11,016 KB
testcase_06 AC 566 ms
63,020 KB
testcase_07 AC 588 ms
62,068 KB
testcase_08 AC 436 ms
49,240 KB
testcase_09 AC 698 ms
72,296 KB
testcase_10 AC 474 ms
52,560 KB
testcase_11 AC 652 ms
69,984 KB
testcase_12 AC 695 ms
74,900 KB
testcase_13 AC 680 ms
71,952 KB
testcase_14 AC 703 ms
73,696 KB
testcase_15 AC 687 ms
72,568 KB
testcase_16 AC 688 ms
73,760 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

accumA = [0]
accumB = [0]
for i in range(n):
    accumA.append(accumA[-1] + A[i])
    accumB.append(accumB[-1] + B[i])
C = []
for i in range(2 * n):
    if i == 0:
        C.append(0)
    elif i <= n:
        C.append(C[-1] + accumA[i] + accumB[i])
    else:
        C.append(C[-1] + accumA[n] - accumA[i - n] - n * A[i - n - 1] + accumB[n] - accumB[i - n] - n * B[i - n - 1])
print(*C)
0