結果
問題 |
No.165 四角で囲え!
|
ユーザー |
![]() |
提出日時 | 2025-06-12 16:59:12 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 632 bytes |
コンパイル時間 | 163 ms |
コンパイル使用メモリ | 82,248 KB |
実行使用メモリ | 55,564 KB |
最終ジャッジ日時 | 2025-06-12 16:59:16 |
合計ジャッジ時間 | 1,729 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 7 WA * 12 |
ソースコード
n, b = map(int, input().split()) points = [] for _ in range(n): x, y, p = map(int, input().split()) points.append((x, y, p)) # Sort the points by their Y-coordinate points.sort(key=lambda p: p[1]) max_count = 0 current_sum = 0 left = 0 for right in range(n): current_sum += points[right][2] # If current_sum exceeds B, move left pointer to reduce the window while current_sum > b: current_sum -= points[left][2] left += 1 # Update the maximum count of points in the window window_size = right - left + 1 if window_size > max_count: max_count = window_size print(max_count)