結果

問題 No.1285 ゴミ捨て
ユーザー roaris
提出日時 2020-11-13 21:30:37
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 91 ms / 2,000 ms
コード長 319 bytes
コンパイル時間 168 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 77,696 KB
最終ジャッジ日時 2024-11-28 21:42:55
合計ジャッジ時間 2,489 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
from collections import *
from heapq import *

N = int(input())
A = [int(input()) for _ in range(N)]
A.sort()
pq = []
ans = 0

for Ai in A:
    if len(pq)>0 and pq[0]+1<Ai:
        heappop(pq)
        heappush(pq, Ai)
    else:
        ans += 1
        heappush(pq, Ai)

print(ans)
0