結果

問題 No.2334 Distinct Cards
ユーザー gr1msl3ygr1msl3y
提出日時 2023-06-10 00:02:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 175 ms / 2,000 ms
コード長 259 bytes
コンパイル時間 1,110 ms
コンパイル使用メモリ 87,288 KB
実行使用メモリ 124,268 KB
最終ジャッジ日時 2023-08-30 15:08:45
合計ジャッジ時間 6,093 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 93 ms
71,552 KB
testcase_01 AC 94 ms
71,600 KB
testcase_02 AC 94 ms
71,304 KB
testcase_03 AC 95 ms
71,564 KB
testcase_04 AC 93 ms
71,512 KB
testcase_05 AC 95 ms
71,576 KB
testcase_06 AC 93 ms
71,652 KB
testcase_07 AC 95 ms
71,544 KB
testcase_08 AC 96 ms
71,552 KB
testcase_09 AC 91 ms
71,624 KB
testcase_10 AC 93 ms
71,520 KB
testcase_11 AC 91 ms
71,544 KB
testcase_12 AC 166 ms
111,836 KB
testcase_13 AC 168 ms
112,052 KB
testcase_14 AC 173 ms
111,692 KB
testcase_15 AC 172 ms
111,872 KB
testcase_16 AC 175 ms
111,676 KB
testcase_17 AC 164 ms
123,764 KB
testcase_18 AC 163 ms
123,980 KB
testcase_19 AC 171 ms
124,268 KB
testcase_20 AC 122 ms
90,816 KB
testcase_21 AC 120 ms
90,760 KB
testcase_22 AC 116 ms
91,276 KB
testcase_23 AC 91 ms
71,624 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter
N, K = map(int, input().split())
A = list(map(int, input().split()))
C = Counter(A)
S = sorted(list(set(A)), key=lambda x: -C[x])
ans = 0
ct = 0
for s in S:
    if ct >= K:
        break
    ct += C[s]
    ans += 1

print(ans)
0