結果

問題 No.2334 Distinct Cards
ユーザー lloyzlloyz
提出日時 2023-06-02 21:22:28
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 133 ms / 2,000 ms
コード長 289 bytes
コンパイル時間 289 ms
コンパイル使用メモリ 87,032 KB
実行使用メモリ 106,660 KB
最終ジャッジ日時 2023-08-28 02:36:06
合計ジャッジ時間 4,085 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 88 ms
71,532 KB
testcase_01 AC 87 ms
71,536 KB
testcase_02 AC 88 ms
71,516 KB
testcase_03 AC 88 ms
71,388 KB
testcase_04 AC 87 ms
71,776 KB
testcase_05 AC 86 ms
71,704 KB
testcase_06 AC 89 ms
71,568 KB
testcase_07 AC 88 ms
71,704 KB
testcase_08 AC 88 ms
71,568 KB
testcase_09 AC 88 ms
71,660 KB
testcase_10 AC 88 ms
71,676 KB
testcase_11 AC 89 ms
71,724 KB
testcase_12 AC 132 ms
100,788 KB
testcase_13 AC 133 ms
101,084 KB
testcase_14 AC 133 ms
101,080 KB
testcase_15 AC 132 ms
100,988 KB
testcase_16 AC 132 ms
101,080 KB
testcase_17 AC 128 ms
106,144 KB
testcase_18 AC 129 ms
106,660 KB
testcase_19 AC 129 ms
106,584 KB
testcase_20 AC 111 ms
91,092 KB
testcase_21 AC 110 ms
90,876 KB
testcase_22 AC 111 ms
91,096 KB
testcase_23 AC 87 ms
71,524 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter

n, k = map(int, input().split())
A = list(map(int, input().split()))

counter = Counter(A)
C = [cnt for cnt in counter.values()]
C.sort(reverse=True)
ans = 0
res = 0
for i in range(n):
    res += C[i]
    ans += 1
    if res >= k:
        break
print(ans)
0