結果

問題 No.2334 Distinct Cards
ユーザー hato336hato336
提出日時 2023-06-02 21:35:06
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 310 ms / 2,000 ms
コード長 612 bytes
コンパイル時間 300 ms
コンパイル使用メモリ 87,128 KB
実行使用メモリ 114,320 KB
最終ジャッジ日時 2023-08-28 02:51:43
合計ジャッジ時間 7,547 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 219 ms
85,168 KB
testcase_01 AC 220 ms
85,236 KB
testcase_02 AC 220 ms
84,992 KB
testcase_03 AC 222 ms
85,324 KB
testcase_04 AC 224 ms
85,168 KB
testcase_05 AC 225 ms
85,092 KB
testcase_06 AC 225 ms
85,060 KB
testcase_07 AC 231 ms
85,848 KB
testcase_08 AC 227 ms
85,164 KB
testcase_09 AC 225 ms
85,984 KB
testcase_10 AC 224 ms
85,584 KB
testcase_11 AC 223 ms
85,704 KB
testcase_12 AC 280 ms
106,364 KB
testcase_13 AC 300 ms
106,084 KB
testcase_14 AC 310 ms
109,088 KB
testcase_15 AC 299 ms
106,332 KB
testcase_16 AC 292 ms
106,200 KB
testcase_17 AC 283 ms
114,132 KB
testcase_18 AC 297 ms
113,976 KB
testcase_19 AC 305 ms
114,320 KB
testcase_20 AC 266 ms
100,072 KB
testcase_21 AC 247 ms
100,092 KB
testcase_22 AC 242 ms
100,336 KB
testcase_23 AC 221 ms
85,064 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import collections,sys,math,functools,operator,itertools,bisect,heapq,decimal,string,time,random
#sys.setrecursionlimit(10**9)
#n = int(input())
n,k = map(int,input().split())
alist = list(map(int,input().split()))
#hen = collections.defaultdict(list)
#s = input()
#
#for i in range(n):
#    alist.append(list(map(int,input().split())))
#    u,v = map(int,input().split())
#    hen[u].append(v)
#    hen[v].append(u)
#dp = [[0]*n for i in range(m)]
c = collections.Counter(alist)
h = []
for i in set(alist):
	heapq.heappush(h,-c[i])
ans = 0
temp = 0
while temp < k:
	ans += 1
	temp -= heapq.heappop(h)
print(ans)
0