結果

問題 No.1285 ゴミ捨て
ユーザー qibqib
提出日時 2022-10-28 21:46:49
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 338 bytes
コンパイル時間 273 ms
コンパイル使用メモリ 86,832 KB
実行使用メモリ 80,368 KB
最終ジャッジ日時 2023-09-20 04:40:06
合計ジャッジ時間 6,178 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,372 KB
testcase_01 AC 74 ms
71,016 KB
testcase_02 AC 75 ms
71,400 KB
testcase_03 AC 75 ms
71,328 KB
testcase_04 AC 73 ms
71,400 KB
testcase_05 AC 75 ms
71,148 KB
testcase_06 AC 74 ms
71,248 KB
testcase_07 WA -
testcase_08 AC 113 ms
77,688 KB
testcase_09 AC 161 ms
78,644 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 119 ms
77,896 KB
testcase_17 AC 120 ms
77,632 KB
testcase_18 AC 119 ms
77,460 KB
testcase_19 WA -
testcase_20 AC 119 ms
77,804 KB
testcase_21 AC 139 ms
77,964 KB
testcase_22 WA -
testcase_23 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect as bs

n = int(input())
a = sorted([int(input()) for _ in range(n)])

used = [False for _ in range(n)]
ans = 0
for i in range(n):
  if used[i]:
    continue
  used[i] = True
  ans += 1
  cur = i
  while cur < n:
    j = bs.bisect_left(a, a[cur] + 2)
    if j < n and not used[j]:
      used[j] = True
    cur = j

print(ans)
0