結果

問題 No.2334 Distinct Cards
ユーザー vwxyzvwxyz
提出日時 2023-06-09 07:06:14
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 280 ms / 2,000 ms
コード長 273 bytes
コンパイル時間 104 ms
コンパイル使用メモリ 10,684 KB
実行使用メモリ 32,664 KB
最終ジャッジ日時 2023-08-30 05:01:11
合計ジャッジ時間 4,673 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
8,604 KB
testcase_01 AC 19 ms
8,516 KB
testcase_02 AC 19 ms
8,648 KB
testcase_03 AC 19 ms
8,468 KB
testcase_04 AC 19 ms
8,536 KB
testcase_05 AC 20 ms
8,600 KB
testcase_06 AC 19 ms
8,648 KB
testcase_07 AC 20 ms
8,592 KB
testcase_08 AC 20 ms
8,708 KB
testcase_09 AC 20 ms
8,688 KB
testcase_10 AC 20 ms
8,716 KB
testcase_11 AC 20 ms
8,752 KB
testcase_12 AC 183 ms
20,248 KB
testcase_13 AC 184 ms
20,352 KB
testcase_14 AC 192 ms
22,732 KB
testcase_15 AC 181 ms
20,384 KB
testcase_16 AC 179 ms
20,332 KB
testcase_17 AC 266 ms
25,268 KB
testcase_18 AC 266 ms
27,780 KB
testcase_19 AC 280 ms
32,664 KB
testcase_20 AC 59 ms
19,320 KB
testcase_21 AC 61 ms
19,452 KB
testcase_22 AC 61 ms
19,372 KB
testcase_23 AC 19 ms
8,476 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
readline=sys.stdin.readline
from collections import Counter

N,K=map(int,readline().split())
A=list(map(int,readline().split()))
C=Counter(A)
lst=[(c,a) for a,c in C.items()]
lst.sort(reverse=True)
A=[]
for c,a in lst:
    A+=[a]*c
ans=len(set(A[:K]))
print(ans)
0