結果

問題 No.1160 Strange Bowling
ユーザー 37zigen37zigen
提出日時 2020-08-19 06:02:55
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 502 ms / 2,000 ms
コード長 276 bytes
コンパイル時間 93 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 27,904 KB
最終ジャッジ日時 2024-04-20 08:12:01
合計ジャッジ時間 7,208 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,624 KB
testcase_01 AC 30 ms
10,624 KB
testcase_02 AC 29 ms
10,752 KB
testcase_03 AC 30 ms
10,624 KB
testcase_04 AC 30 ms
10,752 KB
testcase_05 AC 30 ms
10,752 KB
testcase_06 AC 30 ms
10,752 KB
testcase_07 AC 30 ms
10,752 KB
testcase_08 AC 30 ms
10,752 KB
testcase_09 AC 29 ms
10,624 KB
testcase_10 AC 364 ms
21,760 KB
testcase_11 AC 213 ms
16,640 KB
testcase_12 AC 118 ms
13,568 KB
testcase_13 AC 73 ms
12,032 KB
testcase_14 AC 334 ms
20,864 KB
testcase_15 AC 101 ms
12,928 KB
testcase_16 AC 120 ms
13,568 KB
testcase_17 AC 314 ms
20,096 KB
testcase_18 AC 227 ms
17,024 KB
testcase_19 AC 162 ms
14,976 KB
testcase_20 AC 271 ms
18,432 KB
testcase_21 AC 214 ms
16,768 KB
testcase_22 AC 85 ms
12,416 KB
testcase_23 AC 85 ms
12,544 KB
testcase_24 AC 80 ms
12,416 KB
testcase_25 AC 173 ms
15,360 KB
testcase_26 AC 101 ms
12,928 KB
testcase_27 AC 240 ms
17,536 KB
testcase_28 AC 106 ms
13,184 KB
testcase_29 AC 333 ms
20,608 KB
testcase_30 AC 502 ms
27,904 KB
testcase_31 AC 291 ms
19,200 KB
testcase_32 AC 105 ms
13,184 KB
testcase_33 AC 204 ms
16,640 KB
testcase_34 AC 198 ms
16,384 KB
testcase_35 AC 441 ms
24,448 KB
testcase_36 AC 30 ms
10,752 KB
testcase_37 AC 30 ms
10,624 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
ans=0
p=[0]*(N+1)
a=[0]*(N+1)
dp1=[0]*(N+1)
dp2=[0]*(N+1)
for i in range(N):
    p[i],a[i]=map(int,input().split())
for i in range(N-1,-1,-1):
    dp1[i]=p[i]+max(dp1[i+1],dp2[i+1])
    dp2[i]=a[i]+max(dp1[i+1]+p[i+1],dp2[i+1]+a[i+1])
print(max(dp1[0],dp2[0]))
0