結果

問題 No.1285 ゴミ捨て
ユーザー shakayamishakayami
提出日時 2020-11-26 20:31:15
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 158 ms / 2,000 ms
コード長 279 bytes
コンパイル時間 289 ms
コンパイル使用メモリ 86,988 KB
実行使用メモリ 80,012 KB
最終ジャッジ日時 2023-08-19 07:27:09
合計ジャッジ時間 4,256 ms
ジャッジサーバーID
(参考情報)
judge9 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,264 KB
testcase_01 AC 75 ms
71,144 KB
testcase_02 AC 77 ms
71,400 KB
testcase_03 AC 74 ms
71,416 KB
testcase_04 AC 74 ms
71,400 KB
testcase_05 AC 77 ms
71,100 KB
testcase_06 AC 76 ms
71,128 KB
testcase_07 AC 154 ms
79,712 KB
testcase_08 AC 104 ms
76,768 KB
testcase_09 AC 129 ms
78,368 KB
testcase_10 AC 151 ms
80,012 KB
testcase_11 AC 147 ms
79,628 KB
testcase_12 AC 138 ms
78,636 KB
testcase_13 AC 128 ms
78,588 KB
testcase_14 AC 154 ms
79,504 KB
testcase_15 AC 139 ms
78,756 KB
testcase_16 AC 108 ms
77,460 KB
testcase_17 AC 110 ms
77,448 KB
testcase_18 AC 108 ms
77,160 KB
testcase_19 AC 126 ms
78,312 KB
testcase_20 AC 107 ms
77,076 KB
testcase_21 AC 119 ms
77,696 KB
testcase_22 AC 158 ms
79,556 KB
testcase_23 AC 153 ms
79,560 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import heapq
N=int(input())
A=sorted([int(input()) for i in range(N)])
q=[]
heapq.heappush(q,-A[-1])
A.pop()
for i in range(N-1):
    if A[-1]+1<-q[0]:
        heapq.heappop(q)
        heapq.heappush(q,-A[-1])
    else:
        heapq.heappush(q,-A[-1])
    A.pop()
print(len(q))
0