結果

問題 No.2334 Distinct Cards
ユーザー i_takui_taku
提出日時 2023-06-02 21:23:35
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 167 ms / 2,000 ms
コード長 263 bytes
コンパイル時間 980 ms
コンパイル使用メモリ 86,992 KB
実行使用メモリ 106,844 KB
最終ジャッジ日時 2023-08-28 02:38:26
合計ジャッジ時間 5,037 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 95 ms
71,636 KB
testcase_01 AC 96 ms
71,368 KB
testcase_02 AC 95 ms
71,380 KB
testcase_03 AC 96 ms
71,420 KB
testcase_04 AC 93 ms
71,652 KB
testcase_05 AC 95 ms
71,528 KB
testcase_06 AC 97 ms
71,520 KB
testcase_07 AC 96 ms
71,676 KB
testcase_08 AC 97 ms
71,368 KB
testcase_09 AC 99 ms
71,236 KB
testcase_10 AC 96 ms
71,380 KB
testcase_11 AC 96 ms
71,224 KB
testcase_12 AC 166 ms
100,652 KB
testcase_13 AC 167 ms
101,012 KB
testcase_14 AC 165 ms
101,136 KB
testcase_15 AC 166 ms
101,196 KB
testcase_16 AC 163 ms
100,832 KB
testcase_17 AC 149 ms
106,380 KB
testcase_18 AC 149 ms
106,844 KB
testcase_19 AC 150 ms
106,668 KB
testcase_20 AC 121 ms
90,832 KB
testcase_21 AC 122 ms
91,040 KB
testcase_22 AC 122 ms
90,896 KB
testcase_23 AC 95 ms
71,724 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter

N, K = map(int, input().split())
A = list(map(int, input().split()))
cnt = Counter(A)
n = 0
ans = 0
for k, v in sorted(cnt.items(), reverse=True, key=lambda x: x[1]):
    n += v
    ans += 1
    if n >= K:
        break
print(ans)
0