結果

問題 No.1285 ゴミ捨て
ユーザー c-yanc-yan
提出日時 2020-11-13 21:25:14
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 82 ms / 2,000 ms
コード長 214 bytes
コンパイル時間 528 ms
コンパイル使用メモリ 10,552 KB
実行使用メモリ 18,976 KB
最終ジャッジ日時 2023-08-19 07:10:00
合計ジャッジ時間 2,473 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
8,048 KB
testcase_01 AC 14 ms
7,956 KB
testcase_02 AC 15 ms
8,044 KB
testcase_03 AC 15 ms
8,028 KB
testcase_04 AC 14 ms
7,996 KB
testcase_05 AC 13 ms
8,004 KB
testcase_06 AC 14 ms
8,028 KB
testcase_07 AC 80 ms
18,572 KB
testcase_08 AC 17 ms
8,228 KB
testcase_09 AC 42 ms
12,628 KB
testcase_10 AC 71 ms
17,196 KB
testcase_11 AC 64 ms
16,520 KB
testcase_12 AC 52 ms
14,244 KB
testcase_13 AC 51 ms
14,292 KB
testcase_14 AC 76 ms
18,084 KB
testcase_15 AC 57 ms
15,232 KB
testcase_16 AC 26 ms
9,988 KB
testcase_17 AC 26 ms
10,044 KB
testcase_18 AC 25 ms
9,852 KB
testcase_19 AC 38 ms
12,248 KB
testcase_20 AC 23 ms
9,896 KB
testcase_21 AC 29 ms
10,636 KB
testcase_22 AC 82 ms
18,976 KB
testcase_23 AC 82 ms
18,880 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import heappush, heapreplace

N, *A = map(int, open(0).read().split())

A.sort()
q = [A[0]]
for a in A[1:]:
    if a <= q[0] + 1:
        heappush(q, a)
    else:
        heapreplace(q, a)
print(len(q))
0