結果
| 問題 | 
                            No.1160 Strange Bowling
                             | 
                    
| ユーザー | 
                             | 
                    
| 提出日時 | 2022-12-14 23:41:42 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 19 ms / 2,000 ms | 
| コード長 | 324 bytes | 
| コンパイル時間 | 1,537 ms | 
| コンパイル使用メモリ | 166,920 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-11-08 16:10:07 | 
| 合計ジャッジ時間 | 3,014 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 36 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, p, v, a = 0, b = -(1 << 30);
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> p >> v;
        tie(a, b) = make_pair(max(a + p, b + 2 * p), max(a + v, b + 2 * v));
    }
    cout << a << '\n';
}