結果

問題 No.1160 Strange Bowling
ユーザー trineutrontrineutron
提出日時 2021-02-23 15:18:16
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 402 ms / 2,000 ms
コード長 216 bytes
コンパイル時間 264 ms
コンパイル使用メモリ 11,800 KB
実行使用メモリ 19,320 KB
最終ジャッジ日時 2023-10-23 16:27:09
合計ジャッジ時間 9,678 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
10,064 KB
testcase_01 AC 30 ms
10,064 KB
testcase_02 AC 33 ms
10,064 KB
testcase_03 AC 31 ms
10,064 KB
testcase_04 AC 30 ms
10,064 KB
testcase_05 AC 30 ms
10,064 KB
testcase_06 AC 30 ms
10,064 KB
testcase_07 AC 30 ms
10,064 KB
testcase_08 AC 31 ms
10,064 KB
testcase_09 AC 31 ms
10,064 KB
testcase_10 AC 299 ms
15,876 KB
testcase_11 AC 179 ms
13,096 KB
testcase_12 AC 101 ms
11,512 KB
testcase_13 AC 67 ms
10,772 KB
testcase_14 AC 279 ms
15,348 KB
testcase_15 AC 90 ms
11,248 KB
testcase_16 AC 107 ms
11,596 KB
testcase_17 AC 262 ms
14,916 KB
testcase_18 AC 186 ms
13,360 KB
testcase_19 AC 135 ms
12,308 KB
testcase_20 AC 223 ms
14,212 KB
testcase_21 AC 179 ms
13,280 KB
testcase_22 AC 76 ms
10,984 KB
testcase_23 AC 77 ms
10,984 KB
testcase_24 AC 73 ms
10,984 KB
testcase_25 AC 145 ms
12,324 KB
testcase_26 AC 87 ms
11,248 KB
testcase_27 AC 202 ms
13,600 KB
testcase_28 AC 93 ms
11,380 KB
testcase_29 AC 277 ms
15,308 KB
testcase_30 AC 402 ms
19,320 KB
testcase_31 AC 237 ms
14,292 KB
testcase_32 AC 90 ms
11,512 KB
testcase_33 AC 173 ms
13,120 KB
testcase_34 AC 169 ms
12,856 KB
testcase_35 AC 368 ms
16,884 KB
testcase_36 AC 30 ms
10,064 KB
testcase_37 AC 31 ms
10,064 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
dp0 = [0]
dp1 = [-10**10]
for i in range(n):
    p, a = map(int, input().split())
    dp0.append(max(dp0[i], dp1[i] + p) + p)
    dp1.append(max(dp0[i], dp1[i] + a) + a)
print(max(dp0[-1], dp1[-1]))
0