結果

問題 No.2334 Distinct Cards
ユーザー 👑 timitimi
提出日時 2023-06-02 21:31:15
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 124 ms / 2,000 ms
コード長 246 bytes
コンパイル時間 281 ms
コンパイル使用メモリ 87,220 KB
実行使用メモリ 112,556 KB
最終ジャッジ日時 2023-08-28 02:47:22
合計ジャッジ時間 3,612 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,308 KB
testcase_01 AC 69 ms
71,264 KB
testcase_02 AC 68 ms
71,092 KB
testcase_03 AC 76 ms
71,220 KB
testcase_04 AC 69 ms
71,412 KB
testcase_05 AC 68 ms
71,396 KB
testcase_06 AC 72 ms
71,064 KB
testcase_07 AC 73 ms
71,216 KB
testcase_08 AC 70 ms
71,392 KB
testcase_09 AC 71 ms
71,304 KB
testcase_10 AC 70 ms
71,212 KB
testcase_11 AC 71 ms
71,272 KB
testcase_12 AC 120 ms
103,748 KB
testcase_13 AC 123 ms
103,948 KB
testcase_14 AC 124 ms
104,032 KB
testcase_15 AC 121 ms
103,984 KB
testcase_16 AC 122 ms
103,728 KB
testcase_17 AC 119 ms
112,556 KB
testcase_18 AC 119 ms
112,472 KB
testcase_19 AC 120 ms
112,388 KB
testcase_20 AC 91 ms
90,032 KB
testcase_21 AC 90 ms
90,284 KB
testcase_22 AC 90 ms
90,156 KB
testcase_23 AC 70 ms
71,304 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,K=map(int, input().split())
A=list(map(int, input().split()))
D={}
for a in A:
  if a not in D:
    D[a]=0
  D[a]+=1

E=[]
for d in D:
  E.append(D[d])
E=sorted(E)[::-1]
c=0
for i in range(len(E)):
  c+=E[i]
  if c>=K:
    print(i+1)
    exit()
0