結果

問題 No.1285 ゴミ捨て
ユーザー ygd.ygd.
提出日時 2020-11-13 21:26:47
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 137 ms / 2,000 ms
コード長 325 bytes
コンパイル時間 324 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 80,056 KB
最終ジャッジ日時 2024-05-06 14:25:15
合計ジャッジ時間 3,308 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
52,352 KB
testcase_01 AC 40 ms
52,096 KB
testcase_02 AC 40 ms
52,352 KB
testcase_03 AC 40 ms
52,224 KB
testcase_04 AC 39 ms
52,352 KB
testcase_05 AC 41 ms
52,480 KB
testcase_06 AC 42 ms
52,352 KB
testcase_07 AC 133 ms
80,056 KB
testcase_08 AC 72 ms
69,504 KB
testcase_09 AC 104 ms
78,464 KB
testcase_10 AC 126 ms
79,360 KB
testcase_11 AC 122 ms
79,488 KB
testcase_12 AC 108 ms
79,616 KB
testcase_13 AC 109 ms
79,360 KB
testcase_14 AC 130 ms
79,360 KB
testcase_15 AC 117 ms
79,616 KB
testcase_16 AC 91 ms
76,544 KB
testcase_17 AC 91 ms
76,416 KB
testcase_18 AC 90 ms
76,288 KB
testcase_19 AC 101 ms
78,080 KB
testcase_20 AC 83 ms
76,032 KB
testcase_21 AC 93 ms
76,928 KB
testcase_22 AC 137 ms
79,912 KB
testcase_23 AC 137 ms
79,932 KB
権限があれば一括ダウンロードができます

ソースコード

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