結果

問題 No.2334 Distinct Cards
ユーザー Mottchan
提出日時 2023-06-02 21:28:18
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 304 bytes
コンパイル時間 656 ms
コンパイル使用メモリ 81,992 KB
実行使用メモリ 112,408 KB
最終ジャッジ日時 2024-12-28 16:27:59
合計ジャッジ時間 3,337 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 6 WA * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

n,k=map(int,input().split())
l=list(map(int,input().split()))
from collections import defaultdict
d=defaultdict(int)

for i in range(n):
    d[l[i]]+=1

ans=[]
for k,v in d.items():
    ans.append((k,v))

ans.sort(key=lambda x: -x[1])

cnt=0
while k>0:
    k-= ans[cnt][1]
    cnt+=1
else:
    print(cnt)
0