結果

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

ソースコード

diff #

from collections import Counter

N, K = map(int, input().split())
A = list(map(int, input().split()))
cnt = Counter(A)
n = 0
ans = 0
for k, v in sorted(cnt.items(), reverse=True, key=lambda x: x[1]):
    n += v
    ans += 1
    if n >= K:
        break
print(ans)
0