結果

問題 No.1285 ゴミ捨て
ユーザー persimmon-persimmon
提出日時 2021-02-16 19:07:12
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 139 ms / 2,000 ms
コード長 245 bytes
コンパイル時間 183 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 78,464 KB
最終ジャッジ日時 2024-11-28 22:00:55
合計ジャッジ時間 3,246 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
a=[int(input()) for _ in range(n)]
a.sort()
from bisect import bisect_left as b
ary=[a[0]]
for x in a[1:]:
  idx=b(ary,x-1)
  if idx==len(ary):
    ary[-1]=x
  elif idx==0:
    ary.append(x)
  else:
    ary[idx]=x
print(len(ary))
0