結果

問題 No.2334 Distinct Cards
コンテスト
ユーザー Mottchan
提出日時 2023-06-02 21:32:54
言語 PyPy3
(8.0.0 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 97 ms / 2,000 ms
+ 158µs
コード長 311 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 101 ms
コンパイル使用メモリ 64,760 KB
実行使用メモリ 81,176 KB
最終ジャッジ日時 2026-10-15 07:46:30
合計ジャッジ時間 3,589 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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 key,val in d.items():
    ans.append((key,val))

ans.sort(key=lambda x: -x[1])
cnt=0
while k>0:
    k-= ans[cnt][1]
    cnt+=1
else:
    print(cnt)
0