結果
問題 |
No.904 サメトロ
|
ユーザー |
![]() |
提出日時 | 2019-10-11 21:41:07 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 459 bytes |
コンパイル時間 | 86 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 10,880 KB |
最終ジャッジ日時 | 2024-11-25 07:03:51 |
合計ジャッジ時間 | 2,198 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 19 WA * 14 |
ソースコード
def solve(n, xs, ys): sx = sum(xs) sy = sum(ys) if sx < sy: sx, sy = sy, sx delta = sx - sy y_min = delta y_max = sx res = max(y_max - y_min + 1, 0) return res def main(): n = int(input()) xs = [] ys = [] for _ in range(n - 1): x, y = (int(z) for z in input().split()) xs.append(x) ys.append(y) res = solve(n, xs, ys) print(res) if __name__ == "__main__": main()