結果

問題 No.1285 ゴミ捨て
ユーザー c-yanc-yan
提出日時 2020-11-13 21:25:14
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 107 ms / 2,000 ms
コード長 214 bytes
コンパイル時間 256 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 21,636 KB
最終ジャッジ日時 2024-05-06 14:23:48
合計ジャッジ時間 2,637 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
10,752 KB
testcase_01 AC 27 ms
10,880 KB
testcase_02 AC 26 ms
10,752 KB
testcase_03 AC 28 ms
10,752 KB
testcase_04 AC 27 ms
10,752 KB
testcase_05 AC 28 ms
10,752 KB
testcase_06 AC 28 ms
10,752 KB
testcase_07 AC 102 ms
21,204 KB
testcase_08 AC 29 ms
11,136 KB
testcase_09 AC 56 ms
15,200 KB
testcase_10 AC 92 ms
19,820 KB
testcase_11 AC 87 ms
19,084 KB
testcase_12 AC 72 ms
16,888 KB
testcase_13 AC 74 ms
16,876 KB
testcase_14 AC 105 ms
20,608 KB
testcase_15 AC 79 ms
17,752 KB
testcase_16 AC 45 ms
12,656 KB
testcase_17 AC 43 ms
12,672 KB
testcase_18 AC 43 ms
12,544 KB
testcase_19 AC 57 ms
14,796 KB
testcase_20 AC 37 ms
12,416 KB
testcase_21 AC 43 ms
13,256 KB
testcase_22 AC 107 ms
21,632 KB
testcase_23 AC 104 ms
21,636 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