結果

問題 No.1160 Strange Bowling
ユーザー 👑 KazunKazun
提出日時 2020-08-31 14:18:32
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 121 ms / 2,000 ms
コード長 320 bytes
コンパイル時間 179 ms
コンパイル使用メモリ 82,000 KB
実行使用メモリ 84,376 KB
最終ジャッジ日時 2024-04-27 18:09:47
合計ジャッジ時間 5,046 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,372 KB
testcase_01 AC 38 ms
52,876 KB
testcase_02 AC 39 ms
52,492 KB
testcase_03 AC 39 ms
52,004 KB
testcase_04 AC 38 ms
52,404 KB
testcase_05 AC 40 ms
52,404 KB
testcase_06 AC 39 ms
53,496 KB
testcase_07 AC 38 ms
52,436 KB
testcase_08 AC 38 ms
52,708 KB
testcase_09 AC 39 ms
52,656 KB
testcase_10 AC 121 ms
84,376 KB
testcase_11 AC 100 ms
80,284 KB
testcase_12 AC 82 ms
76,704 KB
testcase_13 AC 84 ms
77,304 KB
testcase_14 AC 106 ms
77,940 KB
testcase_15 AC 83 ms
76,820 KB
testcase_16 AC 87 ms
76,748 KB
testcase_17 AC 106 ms
77,716 KB
testcase_18 AC 101 ms
80,980 KB
testcase_19 AC 91 ms
77,056 KB
testcase_20 AC 101 ms
77,208 KB
testcase_21 AC 100 ms
80,472 KB
testcase_22 AC 82 ms
76,820 KB
testcase_23 AC 81 ms
77,280 KB
testcase_24 AC 85 ms
77,048 KB
testcase_25 AC 91 ms
77,312 KB
testcase_26 AC 88 ms
76,736 KB
testcase_27 AC 99 ms
78,756 KB
testcase_28 AC 88 ms
76,536 KB
testcase_29 AC 112 ms
77,768 KB
testcase_30 AC 120 ms
78,552 KB
testcase_31 AC 99 ms
77,616 KB
testcase_32 AC 78 ms
76,696 KB
testcase_33 AC 89 ms
77,140 KB
testcase_34 AC 89 ms
76,932 KB
testcase_35 AC 112 ms
78,552 KB
testcase_36 AC 39 ms
53,420 KB
testcase_37 AC 39 ms
52,664 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
P=[0]*(N+1)
A=[0]*(N+1)

for i in range(1,N+1):
    p,a=map(int,input().split())
    P[i]=p
    A[i]=a

S=[[0,0] for _ in range(N+1)]

S[-1][0]=P[-1]
S[-1][1]=A[-1]

for i in range(N-1,-1,-1):
    S[i][0]=max(S[i+1][0],S[i+1][1])+P[i]
    S[i][1]=max(S[i+1][0]+P[i+1],S[i+1][1]+A[i+1])+A[i]
print(S[0][0])
0