結果

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

ソースコード

diff #

import sys
input = sys.stdin.readline

N, K = map(int, input().split())
A = list(map(int, input().split()))
cnt = [0]*(N+1)
for x in A:
    cnt[x] += 1
cnt.sort(reverse=True)
ans = 0
for x in cnt:
    K -= x
    ans += 1
    if K <= 0:
        break
print(ans)
0