結果

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

ソースコード

diff #

N, K = map(int, input().split())
A = list(map(int, input().split()))

from collections import Counter
counted = Counter(A)
counted = list(counted.items())
counted.sort(key = lambda x:x[1], reverse = True)

card_count = 0
num_count = 0
for num, c in counted:
    num_count += 1
    card_count += c
    if card_count >= K:
        break
print(num_count)

0