結果
問題 |
No.2334 Distinct Cards
|
ユーザー |
|
提出日時 | 2023-06-09 16:54:29 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 355 bytes |
コンパイル時間 | 303 ms |
コンパイル使用メモリ | 82,236 KB |
実行使用メモリ | 99,100 KB |
最終ジャッジ日時 | 2025-01-01 21:21:12 |
合計ジャッジ時間 | 3,266 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 20 WA * 2 |
ソースコード
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)