結果

問題 No.2334 Distinct Cards
ユーザー flygonflygon
提出日時 2023-06-02 21:21:40
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 140 ms / 2,000 ms
コード長 442 bytes
コンパイル時間 273 ms
コンパイル使用メモリ 87,192 KB
実行使用メモリ 106,700 KB
最終ジャッジ日時 2023-08-28 02:33:13
合計ジャッジ時間 4,103 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 91 ms
71,736 KB
testcase_01 AC 91 ms
71,624 KB
testcase_02 AC 90 ms
71,740 KB
testcase_03 AC 90 ms
71,552 KB
testcase_04 AC 90 ms
71,664 KB
testcase_05 AC 91 ms
71,648 KB
testcase_06 AC 89 ms
71,784 KB
testcase_07 AC 92 ms
71,452 KB
testcase_08 AC 91 ms
71,856 KB
testcase_09 AC 92 ms
71,772 KB
testcase_10 AC 91 ms
71,708 KB
testcase_11 AC 90 ms
71,640 KB
testcase_12 AC 136 ms
100,516 KB
testcase_13 AC 139 ms
100,508 KB
testcase_14 AC 140 ms
100,848 KB
testcase_15 AC 140 ms
100,708 KB
testcase_16 AC 140 ms
100,592 KB
testcase_17 AC 135 ms
106,112 KB
testcase_18 AC 138 ms
106,128 KB
testcase_19 AC 138 ms
106,700 KB
testcase_20 AC 115 ms
90,916 KB
testcase_21 AC 113 ms
90,764 KB
testcase_22 AC 115 ms
90,916 KB
testcase_23 AC 93 ms
71,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(5*10**5)
input = sys.stdin.readline
from collections import defaultdict, deque, Counter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right
from math import gcd
n,k = map(int,input().split())
a = list(map(int,input().split()))

d = defaultdict(int)
for i in range(n):
    d[a[i]] += 1

v = list(d.values())
ans = 0
v.sort()
while k > 0:
    ans += 1
    k -=  v.pop()

print(ans)
0