結果

問題 No.2334 Distinct Cards
ユーザー Basin-BugBasin-Bug
提出日時 2023-07-12 11:02:02
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 155 ms / 2,000 ms
コード長 270 bytes
コンパイル時間 468 ms
コンパイル使用メモリ 87,208 KB
実行使用メモリ 106,820 KB
最終ジャッジ日時 2023-10-12 01:11:20
合計ジャッジ時間 5,802 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 108 ms
71,440 KB
testcase_01 AC 102 ms
71,292 KB
testcase_02 AC 100 ms
71,812 KB
testcase_03 AC 99 ms
71,288 KB
testcase_04 AC 98 ms
71,456 KB
testcase_05 AC 100 ms
71,648 KB
testcase_06 AC 103 ms
71,476 KB
testcase_07 AC 101 ms
71,676 KB
testcase_08 AC 100 ms
71,612 KB
testcase_09 AC 100 ms
71,288 KB
testcase_10 AC 101 ms
71,640 KB
testcase_11 AC 99 ms
71,644 KB
testcase_12 AC 155 ms
100,908 KB
testcase_13 AC 147 ms
101,324 KB
testcase_14 AC 148 ms
101,336 KB
testcase_15 AC 145 ms
101,084 KB
testcase_16 AC 146 ms
101,348 KB
testcase_17 AC 138 ms
106,332 KB
testcase_18 AC 142 ms
106,820 KB
testcase_19 AC 141 ms
106,580 KB
testcase_20 AC 125 ms
91,260 KB
testcase_21 AC 120 ms
91,008 KB
testcase_22 AC 121 ms
91,048 KB
testcase_23 AC 99 ms
71,484 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter
N, K = map(int, input().split())
A = list(map(int, input().split()))

items = [k for k in Counter(A).values()]

items.sort(reverse = True)
ans = 0
cnt = 0
i = 0
while cnt < K:
  ans += 1
  cnt += items[i]
  i += 1
print(ans)
0