結果
問題 | No.904 サメトロ |
ユーザー |
![]() |
提出日時 | 2019-10-11 21:40:29 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 457 bytes |
コンパイル時間 | 1,476 ms |
コンパイル使用メモリ | 166,052 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-25 07:03:32 |
合計ジャッジ時間 | 2,507 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 19 WA * 14 |
ソースコード
#include<bits/stdc++.h>#define int long longusing namespace std;template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }template<class T>bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }signed main(){cin.tie(0);ios::sync_with_stdio(false);int N; cin>>N;int L=0,R=0;for(int i=0;i<N-1;i++){int a,b; cin>>a>>b;L+=b-a;R+=b;}cout<<R-max(0LL,L)+1<<endl;return 0;}