結果

問題 No.1285 ゴミ捨て
ユーザー ibyiby
提出日時 2020-11-16 00:21:31
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 254 ms / 2,000 ms
コード長 231 bytes
コンパイル時間 118 ms
コンパイル使用メモリ 10,736 KB
実行使用メモリ 12,792 KB
最終ジャッジ日時 2023-08-19 07:22:51
合計ジャッジ時間 3,904 ms
ジャッジサーバーID
(参考情報)
judge9 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
8,432 KB
testcase_01 AC 18 ms
8,488 KB
testcase_02 AC 18 ms
8,480 KB
testcase_03 AC 18 ms
8,500 KB
testcase_04 AC 18 ms
8,580 KB
testcase_05 AC 18 ms
8,416 KB
testcase_06 AC 18 ms
8,424 KB
testcase_07 AC 251 ms
12,664 KB
testcase_08 AC 27 ms
8,652 KB
testcase_09 AC 112 ms
10,216 KB
testcase_10 AC 218 ms
12,212 KB
testcase_11 AC 193 ms
11,840 KB
testcase_12 AC 145 ms
10,924 KB
testcase_13 AC 147 ms
10,920 KB
testcase_14 AC 235 ms
12,432 KB
testcase_15 AC 170 ms
11,080 KB
testcase_16 AC 59 ms
9,216 KB
testcase_17 AC 60 ms
9,236 KB
testcase_18 AC 58 ms
9,248 KB
testcase_19 AC 105 ms
10,128 KB
testcase_20 AC 55 ms
9,260 KB
testcase_21 AC 70 ms
9,352 KB
testcase_22 AC 254 ms
12,784 KB
testcase_23 AC 254 ms
12,792 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque
n = int(input())
a = [int(input()) for i in range(n)]
a.sort()
stack = deque([a.pop()])
while a:
    x = a.pop()
    if x + 1 < stack[-1]:
        stack.pop()
    stack.appendleft(x)

print(len(stack))
0