結果

問題 No.2334 Distinct Cards
コンテスト
ユーザー もちふわゆるゆる
提出日時 2023-06-02 21:53:26
言語 PyPy3
(8.0.0 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 77 ms / 2,000 ms
+ 918µs
コード長 357 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 98 ms
コンパイル使用メモリ 64,472 KB
実行使用メモリ 84,124 KB
最終ジャッジ日時 2026-10-15 07:47:58
合計ジャッジ時間 3,350 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge5_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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