結果
問題 | No.1285 ゴミ捨て |
ユーザー | neterukun |
提出日時 | 2020-11-13 21:31:17 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 130 ms / 2,000 ms |
コード長 | 349 bytes |
コンパイル時間 | 257 ms |
コンパイル使用メモリ | 82,516 KB |
実行使用メモリ | 77,824 KB |
最終ジャッジ日時 | 2024-11-28 21:42:46 |
合計ジャッジ時間 | 3,207 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 22 |
ソースコード
import heapq n = int(input()) a = [int(input()) for i in range(n)] a.sort() hq = [] for i in range(n): if not hq: heapq.heappush(hq, a[i]) else: top = hq[0] if abs(top - a[i]) > 1: heapq.heappop(hq) heapq.heappush(hq, a[i]) else: heapq.heappush(hq, a[i]) print(len(hq))