結果

問題 No.2334 Distinct Cards
ユーザー ryohei22ryohei22
提出日時 2023-06-02 21:27:19
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 140 ms / 2,000 ms
コード長 249 bytes
コンパイル時間 250 ms
コンパイル使用メモリ 87,012 KB
実行使用メモリ 106,800 KB
最終ジャッジ日時 2023-08-28 02:44:13
合計ジャッジ時間 4,033 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 95 ms
71,260 KB
testcase_01 AC 91 ms
71,744 KB
testcase_02 AC 91 ms
71,496 KB
testcase_03 AC 93 ms
71,760 KB
testcase_04 AC 91 ms
71,684 KB
testcase_05 AC 91 ms
71,792 KB
testcase_06 AC 90 ms
71,660 KB
testcase_07 AC 93 ms
71,796 KB
testcase_08 AC 92 ms
71,488 KB
testcase_09 AC 92 ms
71,488 KB
testcase_10 AC 92 ms
71,484 KB
testcase_11 AC 95 ms
71,692 KB
testcase_12 AC 140 ms
100,848 KB
testcase_13 AC 139 ms
101,112 KB
testcase_14 AC 140 ms
100,924 KB
testcase_15 AC 140 ms
101,052 KB
testcase_16 AC 139 ms
100,984 KB
testcase_17 AC 137 ms
106,576 KB
testcase_18 AC 137 ms
106,800 KB
testcase_19 AC 138 ms
106,724 KB
testcase_20 AC 115 ms
91,108 KB
testcase_21 AC 116 ms
90,972 KB
testcase_22 AC 116 ms
90,956 KB
testcase_23 AC 91 ms
71,532 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter


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

cnt = Counter(A)
lis = [cnt[i] for i in cnt]

lis.sort(reverse=True)

ans = 0
idx = 0
while 0 < K:
	ans += 1
	K -= lis[idx]
	idx += 1
print(ans)
0