結果

問題 No.1160 Strange Bowling
ユーザー brthyyjpbrthyyjp
提出日時 2021-07-05 22:09:00
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 152 ms / 2,000 ms
コード長 330 bytes
コンパイル時間 275 ms
コンパイル使用メモリ 86,572 KB
実行使用メモリ 82,064 KB
最終ジャッジ日時 2023-09-14 04:16:17
合計ジャッジ時間 6,040 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,108 KB
testcase_01 AC 73 ms
71,224 KB
testcase_02 AC 74 ms
70,812 KB
testcase_03 AC 71 ms
71,076 KB
testcase_04 AC 70 ms
70,936 KB
testcase_05 AC 71 ms
71,104 KB
testcase_06 AC 72 ms
71,216 KB
testcase_07 AC 71 ms
70,860 KB
testcase_08 AC 71 ms
71,108 KB
testcase_09 AC 72 ms
71,096 KB
testcase_10 AC 143 ms
81,652 KB
testcase_11 AC 123 ms
79,648 KB
testcase_12 AC 113 ms
77,492 KB
testcase_13 AC 109 ms
77,496 KB
testcase_14 AC 142 ms
81,288 KB
testcase_15 AC 111 ms
77,372 KB
testcase_16 AC 114 ms
77,584 KB
testcase_17 AC 136 ms
80,128 KB
testcase_18 AC 128 ms
80,244 KB
testcase_19 AC 117 ms
78,184 KB
testcase_20 AC 132 ms
80,240 KB
testcase_21 AC 125 ms
79,840 KB
testcase_22 AC 110 ms
77,388 KB
testcase_23 AC 112 ms
77,228 KB
testcase_24 AC 111 ms
77,228 KB
testcase_25 AC 117 ms
78,560 KB
testcase_26 AC 109 ms
77,352 KB
testcase_27 AC 131 ms
80,132 KB
testcase_28 AC 112 ms
77,572 KB
testcase_29 AC 140 ms
81,280 KB
testcase_30 AC 152 ms
82,064 KB
testcase_31 AC 127 ms
80,216 KB
testcase_32 AC 105 ms
77,356 KB
testcase_33 AC 119 ms
79,620 KB
testcase_34 AC 120 ms
79,596 KB
testcase_35 AC 146 ms
81,592 KB
testcase_36 AC 71 ms
71,308 KB
testcase_37 AC 71 ms
71,092 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
PA = []
for i in range(n):
    p, a = map(int, input().split())
    PA.append((p, a))

dp = [0]*2
for i, (p, a) in enumerate(PA):
    nx = [0]*2
    if i != 0:
        nx[0] = max(dp[0]+2*a, dp[1]+a)
        nx[1] = max(dp[0]+2*p, dp[1]+p)
    else:
        nx[0] = a
        nx[1] = p
    dp = nx
print(max(dp))
0