結果

問題 No.2334 Distinct Cards
ユーザー とりゐとりゐ
提出日時 2023-06-02 21:21:31
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 128 ms / 2,000 ms
コード長 266 bytes
コンパイル時間 348 ms
コンパイル使用メモリ 86,880 KB
実行使用メモリ 110,868 KB
最終ジャッジ日時 2023-08-28 02:32:47
合計ジャッジ時間 3,838 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,020 KB
testcase_01 AC 76 ms
71,324 KB
testcase_02 AC 75 ms
71,532 KB
testcase_03 AC 76 ms
71,380 KB
testcase_04 AC 76 ms
71,452 KB
testcase_05 AC 76 ms
71,348 KB
testcase_06 AC 74 ms
71,332 KB
testcase_07 AC 76 ms
71,500 KB
testcase_08 AC 75 ms
71,008 KB
testcase_09 AC 77 ms
71,260 KB
testcase_10 AC 78 ms
71,332 KB
testcase_11 AC 76 ms
71,448 KB
testcase_12 AC 125 ms
102,872 KB
testcase_13 AC 126 ms
102,944 KB
testcase_14 AC 128 ms
102,860 KB
testcase_15 AC 128 ms
103,128 KB
testcase_16 AC 127 ms
102,900 KB
testcase_17 AC 125 ms
110,780 KB
testcase_18 AC 127 ms
110,816 KB
testcase_19 AC 127 ms
110,868 KB
testcase_20 AC 96 ms
90,040 KB
testcase_21 AC 97 ms
90,268 KB
testcase_22 AC 95 ms
90,180 KB
testcase_23 AC 74 ms
71,356 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,K=map(int,input().split())
a=list(map(int,input().split()))

cnt={}
for i in a:
  if i not in cnt:
    cnt[i]=0
  cnt[i]+=1

c=[]
for i in cnt:
  c.append(cnt[i])
c.sort(reverse=True)
res=0
for i in range(len(c)):
  res+=c[i]
  if res>=K:
    print(i+1)
    exit()
0