結果

問題 No.1285 ゴミ捨て
ユーザー persimmon-persimmonpersimmon-persimmon
提出日時 2021-02-16 19:07:12
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 138 ms / 2,000 ms
コード長 245 bytes
コンパイル時間 255 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 78,592 KB
最終ジャッジ日時 2024-05-06 14:44:30
合計ジャッジ時間 3,310 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
51,840 KB
testcase_01 AC 37 ms
52,096 KB
testcase_02 AC 38 ms
52,352 KB
testcase_03 AC 37 ms
52,224 KB
testcase_04 AC 37 ms
52,352 KB
testcase_05 AC 38 ms
52,096 KB
testcase_06 AC 38 ms
52,608 KB
testcase_07 AC 132 ms
77,952 KB
testcase_08 AC 67 ms
70,400 KB
testcase_09 AC 101 ms
77,184 KB
testcase_10 AC 127 ms
78,080 KB
testcase_11 AC 123 ms
77,824 KB
testcase_12 AC 111 ms
77,056 KB
testcase_13 AC 109 ms
77,184 KB
testcase_14 AC 128 ms
78,136 KB
testcase_15 AC 113 ms
77,500 KB
testcase_16 AC 79 ms
76,544 KB
testcase_17 AC 82 ms
76,288 KB
testcase_18 AC 80 ms
76,396 KB
testcase_19 AC 99 ms
77,184 KB
testcase_20 AC 80 ms
76,544 KB
testcase_21 AC 89 ms
76,800 KB
testcase_22 AC 136 ms
78,592 KB
testcase_23 AC 138 ms
78,336 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