結果
問題 |
No.165 四角で囲え!
|
ユーザー |
![]() |
提出日時 | 2025-06-12 21:42:36 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 632 bytes |
コンパイル時間 | 170 ms |
コンパイル使用メモリ | 82,480 KB |
実行使用メモリ | 56,112 KB |
最終ジャッジ日時 | 2025-06-12 21:46:21 |
合計ジャッジ時間 | 1,731 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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)