結果
| 問題 |
No.1285 ゴミ捨て
|
| コンテスト | |
| ユーザー |
lam6er
|
| 提出日時 | 2025-04-15 23:33:01 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 134 ms / 2,000 ms |
| コード長 | 303 bytes |
| コンパイル時間 | 354 ms |
| コンパイル使用メモリ | 81,884 KB |
| 実行使用メモリ | 77,444 KB |
| 最終ジャッジ日時 | 2025-04-15 23:34:12 |
| 合計ジャッジ時間 | 3,055 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 22 |
ソースコード
import bisect
n = int(input())
A = [int(input()) for _ in range(n)]
A.sort()
sorted_list = []
for x in A:
# Find the rightmost value <= x-2
idx = bisect.bisect_right(sorted_list, x - 2)
if idx > 0:
del sorted_list[idx - 1]
bisect.insort(sorted_list, x)
print(len(sorted_list))
lam6er