結果

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

ソースコード

diff #
raw source code

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