結果

問題 No.2334 Distinct Cards
ユーザー yupoohyupooh
提出日時 2023-06-02 21:33:42
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 154 ms / 2,000 ms
コード長 298 bytes
コンパイル時間 322 ms
コンパイル使用メモリ 87,044 KB
実行使用メモリ 111,480 KB
最終ジャッジ日時 2023-08-28 02:50:25
合計ジャッジ時間 4,369 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 98 ms
71,820 KB
testcase_01 AC 98 ms
71,680 KB
testcase_02 AC 97 ms
71,860 KB
testcase_03 AC 94 ms
71,812 KB
testcase_04 AC 94 ms
71,536 KB
testcase_05 AC 95 ms
71,364 KB
testcase_06 AC 93 ms
71,796 KB
testcase_07 AC 97 ms
71,712 KB
testcase_08 AC 95 ms
71,700 KB
testcase_09 AC 97 ms
71,512 KB
testcase_10 AC 95 ms
71,332 KB
testcase_11 AC 98 ms
71,384 KB
testcase_12 AC 152 ms
103,356 KB
testcase_13 AC 153 ms
103,524 KB
testcase_14 AC 154 ms
103,548 KB
testcase_15 AC 153 ms
103,416 KB
testcase_16 AC 149 ms
103,508 KB
testcase_17 AC 149 ms
111,364 KB
testcase_18 AC 148 ms
111,460 KB
testcase_19 AC 148 ms
111,480 KB
testcase_20 AC 118 ms
90,580 KB
testcase_21 AC 118 ms
90,784 KB
testcase_22 AC 121 ms
90,688 KB
testcase_23 AC 97 ms
71,860 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
from collections import defaultdict
n,k=map(int,input().split())
a=list(map(int,input().split()))
dic=defaultdict(int)
for i in a:
  dic[i]+=1
l=[]
for i in dic:
  l.append(dic[i])
l.sort(reverse=True)
now=0
idx=0
while now<k:
  now+=l[idx]
  idx+=1
print(idx)
0