結果

問題 No.2334 Distinct Cards
ユーザー miya145592miya145592
提出日時 2023-06-02 22:32:12
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 115 ms / 2,000 ms
コード長 249 bytes
コンパイル時間 790 ms
コンパイル使用メモリ 87,116 KB
実行使用メモリ 106,236 KB
最終ジャッジ日時 2023-08-28 04:31:44
合計ジャッジ時間 4,093 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,244 KB
testcase_01 AC 69 ms
71,508 KB
testcase_02 AC 70 ms
71,548 KB
testcase_03 AC 72 ms
71,228 KB
testcase_04 AC 70 ms
71,316 KB
testcase_05 AC 71 ms
71,388 KB
testcase_06 AC 71 ms
71,544 KB
testcase_07 AC 71 ms
71,256 KB
testcase_08 AC 70 ms
71,068 KB
testcase_09 AC 72 ms
71,276 KB
testcase_10 AC 72 ms
71,380 KB
testcase_11 AC 71 ms
71,148 KB
testcase_12 AC 112 ms
99,832 KB
testcase_13 AC 114 ms
99,956 KB
testcase_14 AC 115 ms
100,248 KB
testcase_15 AC 114 ms
100,124 KB
testcase_16 AC 115 ms
100,112 KB
testcase_17 AC 110 ms
105,460 KB
testcase_18 AC 112 ms
105,672 KB
testcase_19 AC 110 ms
106,236 KB
testcase_20 AC 93 ms
90,340 KB
testcase_21 AC 92 ms
90,396 KB
testcase_22 AC 93 ms
90,292 KB
testcase_23 AC 70 ms
71,256 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, K = map(int, input().split())
A = list(map(int, input().split()))
D = dict()
for a in A:
    if a not in D:
        D[a]=1
    else:
        D[a]+=1
V = list(D.values())
V.sort()
cnt = 0
while K>0:
    v = V.pop()
    K-=v
    cnt+=1
print(cnt)

0