結果

問題 No.1160 Strange Bowling
ユーザー t98slider
提出日時 2022-12-14 23:42:40
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 19 ms / 2,000 ms
コード長 324 bytes
コンパイル時間 1,929 ms
コンパイル使用メモリ 166,732 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-08 16:11:22
合計ジャッジ時間 3,146 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 36
権限があれば一括ダウンロードができます

ソースコード

diff #

#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 + p + p), max(a + v, b + v + v));
    }
    cout << a << '\n';
}
0