結果

問題 No.999 てん vs. ほむ
ユーザー trineutron
提出日時 2020-02-29 00:46:18
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 96 ms / 2,000 ms
コード長 319 bytes
コンパイル時間 1,921 ms
コンパイル使用メモリ 196,040 KB
最終ジャッジ日時 2025-01-09 03:28:32
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int64_t> s(n + 1);
    for (int i = 0; i < n; i++) {
        int64_t x, y;
        cin >> x >> y;
        s.at(i + 1) = s.at(i) + x - y;
    }
    cout << 2 * *max_element(s.begin(), s.end()) - s.at(0) - s.at(n) << endl;
}
0