結果

問題 No.1160 Strange Bowling
ユーザー Mitarushi
提出日時 2020-08-11 15:34:41
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 591 ms / 2,000 ms
コード長 312 bytes
コンパイル時間 108 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 43,520 KB
最終ジャッジ日時 2024-10-09 11:26:17
合計ジャッジ時間 8,324 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 36
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
pa = [[int(i) for i in input().split()] for _ in range(n)]

dp = [[0] * 2 for _ in range(n)]
dp[0] = pa[0]

for i in range(1, n):
    dp[i][0] = max(dp[i - 1][0] + pa[i][0], dp[i - 1][1] + pa[i][0] * 2)
    dp[i][1] = max(dp[i - 1][0] + pa[i][1], dp[i - 1][1] + pa[i][1] * 2)

print(max(dp[-1]))
0