結果
問題 |
No.596 郵便配達
|
ユーザー |
![]() |
提出日時 | 2025-03-31 17:42:29 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 842 bytes |
コンパイル時間 | 297 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 183,452 KB |
最終ジャッジ日時 | 2025-03-31 17:43:36 |
合計ジャッジ時間 | 3,960 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 min_post = float('inf') max_post = -float('inf') min_all = float('inf') max_all = -float('inf') for _ in range(M): x_i = int(input[ptr]) ptr += 1 d_i = int(input[ptr]) ptr += 1 min_post = min(min_post, x_i) max_post = max(max_post, x_i) min_all = min(min_all, x_i) max_all = max(max_all, x_i) for __ in range(d_i): y_j = int(input[ptr]) ptr += 1 min_all = min(min_all, y_j) max_all = max(max_all, y_j) post_span = max_post - min_post total_span = max_all - min_all print(total_span + post_span) if __name__ == "__main__": main()