結果

問題 No.2196 Pair Bonus
ユーザー ThetaTheta
提出日時 2023-01-27 15:23:32
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 275 ms / 2,000 ms
コード長 611 bytes
コンパイル時間 98 ms
コンパイル使用メモリ 10,816 KB
実行使用メモリ 39,840 KB
最終ジャッジ日時 2023-09-10 10:22:21
合計ジャッジ時間 3,577 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,812 KB
testcase_01 AC 15 ms
7,856 KB
testcase_02 AC 18 ms
7,864 KB
testcase_03 AC 273 ms
39,840 KB
testcase_04 AC 275 ms
39,684 KB
testcase_05 AC 17 ms
8,304 KB
testcase_06 AC 16 ms
8,248 KB
testcase_07 AC 17 ms
8,372 KB
testcase_08 AC 58 ms
14,340 KB
testcase_09 AC 258 ms
37,532 KB
testcase_10 AC 173 ms
27,924 KB
testcase_11 AC 69 ms
15,556 KB
testcase_12 AC 222 ms
33,428 KB
testcase_13 AC 17 ms
8,384 KB
testcase_14 AC 37 ms
10,720 KB
testcase_15 AC 18 ms
8,436 KB
testcase_16 AC 252 ms
38,812 KB
testcase_17 AC 19 ms
8,520 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    N = int(input())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))
    X = list(map(int, input().split()))
    Y = list(map(int, input().split()))

    dp_table = [0 for _ in range(N+1)]
    for idx in range(N):
        dp_table[idx+1] = (
            dp_table[idx]
            + max(
                A[idx*2] + B[idx*2+1] + Y[idx],
                B[idx*2] + A[idx*2+1] + Y[idx],
                A[idx*2] + A[idx*2+1] + X[idx],
                B[idx*2] + B[idx*2+1] + X[idx]
            )
        )

    print(dp_table[-1])


if __name__ == "__main__":
    main()
0