結果

問題 No.1285 ゴミ捨て
ユーザー shakayamishakayami
提出日時 2020-11-26 20:31:15
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 133 ms / 2,000 ms
コード長 279 bytes
コンパイル時間 250 ms
コンパイル使用メモリ 81,792 KB
実行使用メモリ 79,064 KB
最終ジャッジ日時 2024-05-06 14:41:55
合計ジャッジ時間 3,148 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
51,840 KB
testcase_01 AC 37 ms
51,968 KB
testcase_02 AC 37 ms
52,608 KB
testcase_03 AC 37 ms
52,480 KB
testcase_04 AC 37 ms
52,352 KB
testcase_05 AC 38 ms
52,224 KB
testcase_06 AC 40 ms
52,864 KB
testcase_07 AC 117 ms
78,784 KB
testcase_08 AC 67 ms
68,992 KB
testcase_09 AC 96 ms
77,056 KB
testcase_10 AC 117 ms
78,944 KB
testcase_11 AC 115 ms
78,720 KB
testcase_12 AC 106 ms
77,696 KB
testcase_13 AC 100 ms
77,920 KB
testcase_14 AC 121 ms
78,592 KB
testcase_15 AC 109 ms
77,696 KB
testcase_16 AC 79 ms
76,160 KB
testcase_17 AC 80 ms
76,544 KB
testcase_18 AC 77 ms
76,032 KB
testcase_19 AC 96 ms
77,556 KB
testcase_20 AC 78 ms
76,160 KB
testcase_21 AC 89 ms
76,416 KB
testcase_22 AC 133 ms
78,464 KB
testcase_23 AC 121 ms
79,064 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