結果

問題 No.1160 Strange Bowling
ユーザー roarisroaris
提出日時 2020-08-12 16:44:37
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 84 ms / 2,000 ms
コード長 277 bytes
コンパイル時間 224 ms
コンパイル使用メモリ 82,028 KB
実行使用メモリ 85,484 KB
最終ジャッジ日時 2024-04-18 00:44:05
合計ジャッジ時間 3,570 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
52,192 KB
testcase_01 AC 36 ms
52,752 KB
testcase_02 AC 36 ms
53,008 KB
testcase_03 AC 34 ms
52,704 KB
testcase_04 AC 35 ms
52,820 KB
testcase_05 AC 38 ms
53,188 KB
testcase_06 AC 35 ms
53,036 KB
testcase_07 AC 37 ms
52,516 KB
testcase_08 AC 39 ms
52,116 KB
testcase_09 AC 42 ms
52,952 KB
testcase_10 AC 77 ms
82,860 KB
testcase_11 AC 67 ms
79,524 KB
testcase_12 AC 60 ms
73,184 KB
testcase_13 AC 58 ms
69,192 KB
testcase_14 AC 81 ms
82,600 KB
testcase_15 AC 52 ms
71,348 KB
testcase_16 AC 57 ms
74,028 KB
testcase_17 AC 78 ms
81,724 KB
testcase_18 AC 70 ms
79,700 KB
testcase_19 AC 69 ms
78,420 KB
testcase_20 AC 72 ms
80,936 KB
testcase_21 AC 73 ms
79,724 KB
testcase_22 AC 52 ms
70,924 KB
testcase_23 AC 54 ms
71,320 KB
testcase_24 AC 58 ms
69,548 KB
testcase_25 AC 63 ms
78,636 KB
testcase_26 AC 57 ms
72,456 KB
testcase_27 AC 70 ms
80,588 KB
testcase_28 AC 57 ms
72,520 KB
testcase_29 AC 84 ms
81,920 KB
testcase_30 AC 82 ms
85,484 KB
testcase_31 AC 73 ms
81,020 KB
testcase_32 AC 51 ms
71,292 KB
testcase_33 AC 64 ms
79,508 KB
testcase_34 AC 69 ms
79,128 KB
testcase_35 AC 80 ms
84,084 KB
testcase_36 AC 37 ms
52,396 KB
testcase_37 AC 40 ms
52,700 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N = int(input())
dp = [[0]*2 for _ in range(N+1)]
dp[0][1] = -10**18

for i in range(N):
    p, a = map(int, input().split())
    dp[i+1][0] = max(dp[i][0]+p, dp[i][1]+2*p)
    dp[i+1][1] = max(dp[i][0]+a, dp[i][1]+2*a)

print(max(dp[N]))
0