結果

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

ソースコード

diff #

import sys
input = sys.stdin.readline
from collections import defaultdict
n,k=map(int,input().split())
a=list(map(int,input().split()))
dic=defaultdict(int)
for i in a:
  dic[i]+=1
l=[]
for i in dic:
  l.append(dic[i])
l.sort(reverse=True)
now=0
idx=0
while now<k:
  now+=l[idx]
  idx+=1
print(idx)
0