結果

問題 No.2334 Distinct Cards
ユーザー FromBooskaFromBooska
提出日時 2023-06-02 21:25:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 151 ms / 2,000 ms
コード長 353 bytes
コンパイル時間 252 ms
コンパイル使用メモリ 86,652 KB
実行使用メモリ 95,152 KB
最終ジャッジ日時 2023-08-28 02:42:15
合計ジャッジ時間 4,077 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 92 ms
71,732 KB
testcase_01 AC 92 ms
71,376 KB
testcase_02 AC 94 ms
71,380 KB
testcase_03 AC 95 ms
71,376 KB
testcase_04 AC 91 ms
71,584 KB
testcase_05 AC 92 ms
71,724 KB
testcase_06 AC 90 ms
71,508 KB
testcase_07 AC 92 ms
71,504 KB
testcase_08 AC 91 ms
71,756 KB
testcase_09 AC 91 ms
71,628 KB
testcase_10 AC 91 ms
71,704 KB
testcase_11 AC 92 ms
71,368 KB
testcase_12 AC 151 ms
90,560 KB
testcase_13 AC 151 ms
90,544 KB
testcase_14 AC 150 ms
90,608 KB
testcase_15 AC 150 ms
90,480 KB
testcase_16 AC 150 ms
90,564 KB
testcase_17 AC 135 ms
95,076 KB
testcase_18 AC 137 ms
95,152 KB
testcase_19 AC 138 ms
95,024 KB
testcase_20 AC 116 ms
90,476 KB
testcase_21 AC 116 ms
90,592 KB
testcase_22 AC 116 ms
90,608 KB
testcase_23 AC 90 ms
71,704 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

from collections import Counter
counted = Counter(A)
counted = list(counted.items())
counted.sort(key = lambda x:x[1], reverse = True)

card_count = 0
num_count = 0
for num, c in counted:
    num_count += 1
    card_count += c
    if card_count >= K:
        break
print(num_count)

0