結果

問題 No.2334 Distinct Cards
ユーザー Basin-Bug
提出日時 2023-07-12 11:02:02
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 92 ms / 2,000 ms
コード長 270 bytes
コンパイル時間 196 ms
コンパイル使用メモリ 82,460 KB
実行使用メモリ 100,488 KB
最終ジャッジ日時 2024-09-14 01:03:51
合計ジャッジ時間 3,148 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter
N, K = map(int, input().split())
A = list(map(int, input().split()))

items = [k for k in Counter(A).values()]

items.sort(reverse = True)
ans = 0
cnt = 0
i = 0
while cnt < K:
  ans += 1
  cnt += items[i]
  i += 1
print(ans)
0