結果

問題 No.1285 ゴミ捨て
ユーザー neterukunneterukun
提出日時 2020-11-13 21:31:17
言語 PyPy3
(7.3.15)
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 349 bytes
コンパイル時間 324 ms
コンパイル使用メモリ 86,816 KB
実行使用メモリ 79,952 KB
最終ジャッジ日時 2023-08-19 07:13:35
合計ジャッジ時間 9,094 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
71,284 KB
testcase_01 AC 68 ms
71,240 KB
testcase_02 AC 67 ms
71,260 KB
testcase_03 AC 64 ms
70,868 KB
testcase_04 AC 64 ms
71,244 KB
testcase_05 AC 64 ms
70,872 KB
testcase_06 AC 65 ms
71,248 KB
testcase_07 AC 142 ms
78,588 KB
testcase_08 AC 86 ms
76,600 KB
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 AC 100 ms
77,380 KB
testcase_17 AC 93 ms
77,460 KB
testcase_18 AC 98 ms
77,644 KB
testcase_19 RE -
testcase_20 AC 97 ms
77,368 KB
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

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))
0