結果
問題 | No.2334 Distinct Cards |
ユーザー |
|
提出日時 | 2023-06-02 21:35:06 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 266 ms / 2,000 ms |
コード長 | 612 bytes |
コンパイル時間 | 258 ms |
コンパイル使用メモリ | 81,792 KB |
実行使用メモリ | 140,160 KB |
最終ジャッジ日時 | 2024-12-28 16:41:58 |
合計ジャッジ時間 | 6,158 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 22 |
ソースコード
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)