結果
問題 |
No.448 ゆきこーだーの雨と雪 (3)
|
ユーザー |
![]() |
提出日時 | 2025-06-12 14:11:01 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 856 bytes |
コンパイル時間 | 749 ms |
コンパイル使用メモリ | 82,296 KB |
実行使用メモリ | 101,004 KB |
最終ジャッジ日時 | 2025-06-12 14:12:27 |
合計ジャッジ時間 | 19,394 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 11 WA * 24 |
ソースコード
import bisect n, k = map(int, input().split()) tasks = [] for _ in range(n): t, d = map(int, input().split()) tasks.append((t, d)) # Sort tasks by descending D, then ascending T tasks.sort(key=lambda x: (-x[1], x[0])) scheduled = [] added_times = set() for t, d in tasks: # Check if this task can be added low = t - k + 1 high = t + k - 1 # Find the left and right positions in the scheduled list left = bisect.bisect_left(scheduled, low) right = bisect.bisect_right(scheduled, high) if left == right: # No existing tasks in the range [low, high] bisect.insort(scheduled, t) added_times.add(t) # Collect all tasks not in scheduled max_d = 0 sum_d = 0 for t, d in tasks: if t not in added_times: if d > max_d: max_d = d sum_d += d print(max_d) print(sum_d)