結果

問題 No.2334 Distinct Cards
ユーザー ryohei22
提出日時 2023-06-02 21:27:19
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 85 ms / 2,000 ms
コード長 249 bytes
コンパイル時間 413 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 100,864 KB
最終ジャッジ日時 2024-12-28 16:25:28
合計ジャッジ時間 2,717 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter


N, K = map(int, input().split())
A = list(map(int, input().split()))

cnt = Counter(A)
lis = [cnt[i] for i in cnt]

lis.sort(reverse=True)

ans = 0
idx = 0
while 0 < K:
	ans += 1
	K -= lis[idx]
	idx += 1
print(ans)
0