結果

問題 No.1160 Strange Bowling
ユーザー lloyzlloyz
提出日時 2022-07-08 15:05:12
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 632 ms / 2,000 ms
コード長 436 bytes
コンパイル時間 195 ms
コンパイル使用メモリ 10,944 KB
実行使用メモリ 45,712 KB
最終ジャッジ日時 2023-08-27 12:44:16
合計ジャッジ時間 9,440 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,780 KB
testcase_01 AC 15 ms
7,852 KB
testcase_02 AC 16 ms
7,896 KB
testcase_03 AC 15 ms
7,984 KB
testcase_04 AC 15 ms
7,804 KB
testcase_05 AC 15 ms
7,932 KB
testcase_06 AC 15 ms
7,800 KB
testcase_07 AC 15 ms
7,780 KB
testcase_08 AC 15 ms
7,784 KB
testcase_09 AC 15 ms
7,808 KB
testcase_10 AC 445 ms
34,328 KB
testcase_11 AC 241 ms
22,272 KB
testcase_12 AC 126 ms
15,048 KB
testcase_13 AC 68 ms
11,632 KB
testcase_14 AC 393 ms
31,908 KB
testcase_15 AC 101 ms
13,512 KB
testcase_16 AC 126 ms
14,968 KB
testcase_17 AC 369 ms
30,036 KB
testcase_18 AC 254 ms
23,256 KB
testcase_19 AC 178 ms
18,140 KB
testcase_20 AC 319 ms
26,748 KB
testcase_21 AC 243 ms
22,448 KB
testcase_22 AC 87 ms
12,544 KB
testcase_23 AC 85 ms
12,520 KB
testcase_24 AC 79 ms
12,216 KB
testcase_25 AC 191 ms
19,104 KB
testcase_26 AC 103 ms
13,528 KB
testcase_27 AC 282 ms
24,472 KB
testcase_28 AC 110 ms
13,852 KB
testcase_29 AC 399 ms
31,764 KB
testcase_30 AC 632 ms
45,712 KB
testcase_31 AC 342 ms
28,316 KB
testcase_32 AC 108 ms
13,984 KB
testcase_33 AC 236 ms
22,032 KB
testcase_34 AC 227 ms
21,528 KB
testcase_35 AC 537 ms
39,984 KB
testcase_36 AC 16 ms
7,780 KB
testcase_37 AC 15 ms
7,840 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
P = [list(map(int, input().split())) for _ in range(n)]

DP = [[0 for _ in range(2)] for _ in range(n + 1)]
for i in range(n):
    DP[i + 1][0] = max(DP[i + 1][0], DP[i][0] + P[i][0])
    if i >= 1:
        DP[i + 1][0] = max(DP[i + 1][0], DP[i][1] + 2 * P[i][0])
    DP[i + 1][1] = max(DP[i + 1][1], DP[i][0] + P[i][1])
    if i >= 1:
        DP[i + 1][1] = max(DP[i + 1][1], DP[i][1] + 2 * P[i][1])
print(max(DP[n]))
0