結果

問題 No.904 サメトロ
ユーザー titia
提出日時 2019-10-11 21:50:01
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 208 bytes
コンパイル時間 136 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-11-25 07:14:06
合計ジャッジ時間 2,133 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20 WA * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

N=int(input())
S=[tuple(map(int,input().split())) for i in range(N-1)]

if N==2:
    print(1)
    sys.exit()

MAX=0
MIN=0
for x,y in S:
    MAX+=y
    MIN+=y-x
    
print(max(0,MAX-max(MIN,0)+1))
0