結果
| 問題 |
No.2334 Distinct Cards
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-06-09 16:57:54 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 76 ms / 2,000 ms |
| コード長 | 395 bytes |
| コンパイル時間 | 533 ms |
| コンパイル使用メモリ | 82,404 KB |
| 実行使用メモリ | 99,580 KB |
| 最終ジャッジ日時 | 2025-01-01 21:24:27 |
| 合計ジャッジ時間 | 2,784 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 22 |
ソースコード
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
if count==0 and len(A)!=0:
count+=1
print(count)