結果

問題 No.2334 Distinct Cards
ユーザー MottchanMottchan
提出日時 2023-06-02 21:32:54
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 155 ms / 2,000 ms
コード長 311 bytes
コンパイル時間 289 ms
コンパイル使用メモリ 86,588 KB
実行使用メモリ 100,172 KB
最終ジャッジ日時 2023-08-28 02:49:18
合計ジャッジ時間 4,128 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 90 ms
71,644 KB
testcase_01 AC 90 ms
71,372 KB
testcase_02 AC 90 ms
71,464 KB
testcase_03 AC 90 ms
71,688 KB
testcase_04 AC 90 ms
71,604 KB
testcase_05 AC 91 ms
71,540 KB
testcase_06 AC 91 ms
71,600 KB
testcase_07 AC 91 ms
71,576 KB
testcase_08 AC 91 ms
71,544 KB
testcase_09 AC 92 ms
71,528 KB
testcase_10 AC 91 ms
71,592 KB
testcase_11 AC 91 ms
71,432 KB
testcase_12 AC 153 ms
91,968 KB
testcase_13 AC 155 ms
92,008 KB
testcase_14 AC 154 ms
91,888 KB
testcase_15 AC 152 ms
91,880 KB
testcase_16 AC 153 ms
91,840 KB
testcase_17 AC 144 ms
100,044 KB
testcase_18 AC 146 ms
100,172 KB
testcase_19 AC 145 ms
100,048 KB
testcase_20 AC 113 ms
90,648 KB
testcase_21 AC 115 ms
90,564 KB
testcase_22 AC 115 ms
90,380 KB
testcase_23 AC 90 ms
71,532 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,k=map(int,input().split())
l=list(map(int,input().split()))
from collections import defaultdict
d=defaultdict(int)

for i in range(n):
    d[l[i]]+=1

ans=[]
for key,val in d.items():
    ans.append((key,val))

ans.sort(key=lambda x: -x[1])
cnt=0
while k>0:
    k-= ans[cnt][1]
    cnt+=1
else:
    print(cnt)
0