結果

問題 No.1285 ゴミ捨て
ユーザー persimmon-persimmonpersimmon-persimmon
提出日時 2021-02-16 19:07:12
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 151 ms / 2,000 ms
コード長 245 bytes
コンパイル時間 457 ms
コンパイル使用メモリ 87,208 KB
実行使用メモリ 79,416 KB
最終ジャッジ日時 2023-08-19 07:29:46
合計ジャッジ時間 4,003 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
71,388 KB
testcase_01 AC 64 ms
71,256 KB
testcase_02 AC 62 ms
71,460 KB
testcase_03 AC 64 ms
70,976 KB
testcase_04 AC 63 ms
71,240 KB
testcase_05 AC 65 ms
71,212 KB
testcase_06 AC 63 ms
71,096 KB
testcase_07 AC 135 ms
79,208 KB
testcase_08 AC 85 ms
76,636 KB
testcase_09 AC 110 ms
78,248 KB
testcase_10 AC 135 ms
79,080 KB
testcase_11 AC 134 ms
79,376 KB
testcase_12 AC 122 ms
78,896 KB
testcase_13 AC 117 ms
78,628 KB
testcase_14 AC 133 ms
79,188 KB
testcase_15 AC 120 ms
78,668 KB
testcase_16 AC 93 ms
77,196 KB
testcase_17 AC 96 ms
77,312 KB
testcase_18 AC 96 ms
77,520 KB
testcase_19 AC 109 ms
78,188 KB
testcase_20 AC 90 ms
77,256 KB
testcase_21 AC 99 ms
77,800 KB
testcase_22 AC 143 ms
79,416 KB
testcase_23 AC 151 ms
79,368 KB
権限があれば一括ダウンロードができます

ソースコード

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