結果
| 問題 | No.904 サメトロ |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-07-17 09:24:25 |
| 言語 | Python3 (3.14.3 + numpy 2.4.2 + scipy 1.17.0) |
| 結果 |
AC
|
| 実行時間 | 528 ms / 1,000 ms |
| コード長 | 339 bytes |
| 記録 | |
| コンパイル時間 | 435 ms |
| コンパイル使用メモリ | 20,700 KB |
| 実行使用メモリ | 35,144 KB |
| 最終ジャッジ日時 | 2026-03-18 22:19:01 |
| 合計ジャッジ時間 | 21,932 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 33 |
ソースコード
import numpy as np N = int(input()) AB = np.array(tuple(tuple(map(int, input().split())) for _ in range(N - 1))) a1_max = np.sum(AB[:, 1]) b1_max = np.sum(AB[:, 0]) other_sum_max = np.max(np.sum(AB, axis=1)) a1_min = max(0, other_sum_max - b1_max) b1_min = max(0, other_sum_max - a1_max) print(min(a1_max - a1_min, b1_max - b1_min) + 1)