結果
問題 |
No.904 サメトロ
|
ユーザー |
👑 |
提出日時 | 2022-01-19 00:14:54 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 42 ms / 1,000 ms |
コード長 | 313 bytes |
コンパイル時間 | 325 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 52,224 KB |
最終ジャッジ日時 | 2024-11-23 13:38:15 |
合計ジャッジ時間 | 3,204 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 33 |
ソースコード
n = int(input()) a_tot = 0 b_tot = 0 max_ = 0 for _ in range(n - 1): a, b = map(int, input().split()) a_tot += a b_tot += b max_ = max(max_, a + b) max_a = b_tot min_a = max(0, max_ - a_tot) a = max_a - min_a + 1 max_b = a_tot min_b = max(0, max_ - b_tot) b = max_b - min_b + 1 print(min(a, b))