結果

問題 No.1160 Strange Bowling
ユーザー MitarushiMitarushi
提出日時 2020-08-11 15:34:41
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 588 ms / 2,000 ms
コード長 312 bytes
コンパイル時間 107 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 43,520 KB
最終ジャッジ日時 2024-04-17 17:17:59
合計ジャッジ時間 8,336 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
10,752 KB
testcase_01 AC 33 ms
10,752 KB
testcase_02 AC 34 ms
10,752 KB
testcase_03 AC 33 ms
10,752 KB
testcase_04 AC 33 ms
10,752 KB
testcase_05 AC 33 ms
10,752 KB
testcase_06 AC 32 ms
10,752 KB
testcase_07 AC 31 ms
10,752 KB
testcase_08 AC 37 ms
10,752 KB
testcase_09 AC 31 ms
10,752 KB
testcase_10 AC 427 ms
33,408 KB
testcase_11 AC 241 ms
23,040 KB
testcase_12 AC 132 ms
16,768 KB
testcase_13 AC 82 ms
13,568 KB
testcase_14 AC 393 ms
31,360 KB
testcase_15 AC 113 ms
15,488 KB
testcase_16 AC 137 ms
16,896 KB
testcase_17 AC 372 ms
29,824 KB
testcase_18 AC 261 ms
23,936 KB
testcase_19 AC 183 ms
19,456 KB
testcase_20 AC 315 ms
26,880 KB
testcase_21 AC 239 ms
23,040 KB
testcase_22 AC 96 ms
14,464 KB
testcase_23 AC 94 ms
14,464 KB
testcase_24 AC 91 ms
14,080 KB
testcase_25 AC 190 ms
20,352 KB
testcase_26 AC 112 ms
15,360 KB
testcase_27 AC 285 ms
24,960 KB
testcase_28 AC 121 ms
15,744 KB
testcase_29 AC 391 ms
31,104 KB
testcase_30 AC 588 ms
43,520 KB
testcase_31 AC 333 ms
28,160 KB
testcase_32 AC 114 ms
15,744 KB
testcase_33 AC 232 ms
22,784 KB
testcase_34 AC 223 ms
22,272 KB
testcase_35 AC 506 ms
38,400 KB
testcase_36 AC 32 ms
10,752 KB
testcase_37 AC 31 ms
10,624 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
pa = [[int(i) for i in input().split()] for _ in range(n)]

dp = [[0] * 2 for _ in range(n)]
dp[0] = pa[0]

for i in range(1, n):
    dp[i][0] = max(dp[i - 1][0] + pa[i][0], dp[i - 1][1] + pa[i][0] * 2)
    dp[i][1] = max(dp[i - 1][0] + pa[i][1], dp[i - 1][1] + pa[i][1] * 2)

print(max(dp[-1]))
0