結果

問題 No.2334 Distinct Cards
ユーザー もちふわゆるゆる
提出日時 2023-06-02 21:53:26
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 112 ms / 2,000 ms
コード長 357 bytes
コンパイル時間 384 ms
コンパイル使用メモリ 82,196 KB
実行使用メモリ 109,824 KB
最終ジャッジ日時 2024-12-28 17:27:37
合計ジャッジ時間 3,007 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys, math
input = lambda: sys.stdin.readline()[:-1]
def MI(): return map(int, input().split())
inf = 10**18
from collections import *

n,k = MI()
a = list(MI())

cnt = Counter(a)
cnt = sorted(cnt.items(), key=lambda x:x[1], reverse=True)

now = 0
ans = 0
for key, value in cnt:
    if now >= k:
        break
    now += value
    ans += 1
print(ans)
0