結果
| 問題 | 
                            No.1160 Strange Bowling
                             | 
                    
| ユーザー | 
                             | 
                    
| 提出日時 | 2022-11-14 18:28:34 | 
| 言語 | Python3  (3.13.1 + numpy 2.2.1 + scipy 1.14.1)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 395 ms / 2,000 ms | 
| コード長 | 456 bytes | 
| コンパイル時間 | 294 ms | 
| コンパイル使用メモリ | 12,672 KB | 
| 実行使用メモリ | 20,188 KB | 
| 最終ジャッジ日時 | 2024-09-15 21:03:41 | 
| 合計ジャッジ時間 | 7,240 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge6 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 36 | 
ソースコード
from math import inf
def main():
    scores_normal = [0]
    scores_bonus = [-inf]
    for idx in range(int(input())):
        p, a = map(int, input().split())
        scores_normal.append(
            max(scores_normal[idx]+p, scores_bonus[idx]+2*p)
        )
        scores_bonus.append(
            max(scores_normal[idx]+a, scores_bonus[idx]+2*a)
        )
    print(max(scores_normal[-1], scores_bonus[-1]))
if __name__ == "__main__":
    main()