結果

問題 No.1160 Strange Bowling
ユーザー rlangevinrlangevin
提出日時 2023-01-11 12:31:34
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 211 ms / 2,000 ms
コード長 345 bytes
コンパイル時間 285 ms
コンパイル使用メモリ 86,764 KB
実行使用メモリ 98,824 KB
最終ジャッジ日時 2023-08-23 19:47:42
合計ジャッジ時間 8,644 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,344 KB
testcase_01 AC 73 ms
71,008 KB
testcase_02 AC 78 ms
71,240 KB
testcase_03 AC 74 ms
71,004 KB
testcase_04 AC 73 ms
71,224 KB
testcase_05 AC 74 ms
71,052 KB
testcase_06 AC 71 ms
71,240 KB
testcase_07 AC 72 ms
71,148 KB
testcase_08 AC 74 ms
71,216 KB
testcase_09 AC 74 ms
71,168 KB
testcase_10 AC 196 ms
94,800 KB
testcase_11 AC 154 ms
86,516 KB
testcase_12 AC 132 ms
81,652 KB
testcase_13 AC 121 ms
78,616 KB
testcase_14 AC 182 ms
91,844 KB
testcase_15 AC 125 ms
79,128 KB
testcase_16 AC 130 ms
81,480 KB
testcase_17 AC 175 ms
91,304 KB
testcase_18 AC 157 ms
86,740 KB
testcase_19 AC 140 ms
82,740 KB
testcase_20 AC 169 ms
88,904 KB
testcase_21 AC 153 ms
86,492 KB
testcase_22 AC 123 ms
78,876 KB
testcase_23 AC 124 ms
78,984 KB
testcase_24 AC 121 ms
78,736 KB
testcase_25 AC 141 ms
83,128 KB
testcase_26 AC 126 ms
79,092 KB
testcase_27 AC 160 ms
86,820 KB
testcase_28 AC 129 ms
80,952 KB
testcase_29 AC 182 ms
91,952 KB
testcase_30 AC 211 ms
98,824 KB
testcase_31 AC 164 ms
90,760 KB
testcase_32 AC 121 ms
79,464 KB
testcase_33 AC 148 ms
86,304 KB
testcase_34 AC 146 ms
86,108 KB
testcase_35 AC 196 ms
96,224 KB
testcase_36 AC 74 ms
71,204 KB
testcase_37 AC 74 ms
71,196 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
inf = 10 ** 18
dp = [[-inf] * 2 for i in range(N + 1)]
dp[0][0] = 0
D = []
for i in range(N):
    D.append(list(map(int, input().split())))

for i in range(N):
    p, a = D[i]
    dp[i + 1][0] = max(dp[i + 1][0], dp[i][0] + p, dp[i][1] + 2*p)
    dp[i + 1][1] = max(dp[i + 1][1], dp[i][0] + a, dp[i][1] + 2*a)
print(max(dp[-1]))
0