結果
問題 |
No.596 郵便配達
|
ユーザー |
![]() |
提出日時 | 2025-06-12 13:09:25 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 952 bytes |
コンパイル時間 | 204 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 225,996 KB |
最終ジャッジ日時 | 2025-06-12 13:12:50 |
合計ジャッジ時間 | 4,155 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 8 WA * 15 |
ソースコード
def main(): import sys input = sys.stdin.read().split() ptr = 0 N = int(input[ptr]) ptr += 1 M = int(input[ptr]) ptr += 1 post_x = [] destinations = [] for _ in range(M): x = int(input[ptr]) ptr += 1 d = int(input[ptr]) ptr += 1 post_x.append(x) for __ in range(d): y = int(input[ptr]) ptr += 1 destinations.append(y) if not post_x: p_min = p_max = 0 else: p_min = min(post_x) p_max = max(post_x) if not destinations: d_min = d_max = 0 else: d_min = min(destinations) d_max = max(destinations) # Calculate the four components part1 = p_max - p_min part2 = d_max - d_min part3 = max(0, p_max - d_max) part4 = max(0, d_min - p_min) total = part1 + part2 + part3 + part4 print(total) if __name__ == '__main__': main()