結果

問題 No.904 サメトロ
ユーザー rlangevin
提出日時 2023-01-24 08:45:59
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 199 bytes
コンパイル時間 274 ms
コンパイル使用メモリ 82,192 KB
実行使用メモリ 54,096 KB
最終ジャッジ日時 2024-06-25 23:23:22
合計ジャッジ時間 2,902 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20 WA * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
if N == 2:
    print(1)
    exit()

A, B = 0, 0
for i in range(N - 1):
    a, b = map(int, input().split())
    A += a
    B += b
maxv = B
minv = max(0, B - A)
print(maxv - minv + 1)
0