結果

問題 No.2334 Distinct Cards
ユーザー QroQro
提出日時 2023-06-09 16:54:29
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 355 bytes
コンパイル時間 1,808 ms
コンパイル使用メモリ 87,076 KB
実行使用メモリ 105,636 KB
最終ジャッジ日時 2023-08-30 10:03:31
合計ジャッジ時間 6,629 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,484 KB
testcase_01 AC 74 ms
71,212 KB
testcase_02 AC 75 ms
71,304 KB
testcase_03 AC 77 ms
71,532 KB
testcase_04 AC 75 ms
71,436 KB
testcase_05 AC 74 ms
71,264 KB
testcase_06 AC 75 ms
71,108 KB
testcase_07 AC 73 ms
71,388 KB
testcase_08 AC 73 ms
71,252 KB
testcase_09 AC 74 ms
71,312 KB
testcase_10 AC 75 ms
71,404 KB
testcase_11 AC 76 ms
71,468 KB
testcase_12 AC 140 ms
100,100 KB
testcase_13 AC 122 ms
100,012 KB
testcase_14 AC 122 ms
100,036 KB
testcase_15 AC 118 ms
99,920 KB
testcase_16 AC 120 ms
99,988 KB
testcase_17 AC 116 ms
105,636 KB
testcase_18 AC 116 ms
105,548 KB
testcase_19 AC 112 ms
105,636 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 97 ms
90,300 KB
testcase_23 AC 74 ms
71,192 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,K=map(int,input().split())
A=list(map(int,input().split()))
CardDict={}
for i in range(N):
    if A[i] in CardDict:
        CardDict[A[i]]+=1
    else:
        CardDict[A[i]]=1

Asorted=list(CardDict.values())
Asorted.sort(reverse=True)
count=0
for i in range(len(Asorted)):
    if K-Asorted[i]>=0:
        K-=Asorted[i]
        count+=1

print(count)

0