結果

問題 No.1285 ゴミ捨て
ユーザー ygd.ygd.
提出日時 2020-11-13 21:26:47
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 137 ms / 2,000 ms
コード長 325 bytes
コンパイル時間 256 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 79,896 KB
最終ジャッジ日時 2024-11-28 21:40:58
合計ジャッジ時間 3,187 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import heapify, heappop, heappush
N = int(input())
A = []
for i in range(N):
    temp = int(input())
    A.append(temp)
A.sort()
X = []
heappush(X,A[0])

for i in range(1,N):
    nxt = A[i]
    if nxt <= X[0] + 1:
        heappush(X,nxt)
    else:
        heappop(X)
        heappush(X,nxt)
ans = len(X)
print(ans)
0