結果

問題 No.2334 Distinct Cards
ユーザー もちふわゆるゆるもちふわゆるゆる
提出日時 2023-06-02 21:53:26
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 159 ms / 2,000 ms
コード長 357 bytes
コンパイル時間 291 ms
コンパイル使用メモリ 87,156 KB
実行使用メモリ 106,856 KB
最終ジャッジ日時 2023-08-28 03:17:25
合計ジャッジ時間 4,245 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 93 ms
71,692 KB
testcase_01 AC 92 ms
71,684 KB
testcase_02 AC 92 ms
71,432 KB
testcase_03 AC 92 ms
71,572 KB
testcase_04 AC 94 ms
71,340 KB
testcase_05 AC 94 ms
71,764 KB
testcase_06 AC 91 ms
71,712 KB
testcase_07 AC 92 ms
71,728 KB
testcase_08 AC 95 ms
71,552 KB
testcase_09 AC 94 ms
71,512 KB
testcase_10 AC 92 ms
71,704 KB
testcase_11 AC 93 ms
71,508 KB
testcase_12 AC 158 ms
100,616 KB
testcase_13 AC 156 ms
101,032 KB
testcase_14 AC 157 ms
101,192 KB
testcase_15 AC 159 ms
100,864 KB
testcase_16 AC 158 ms
100,856 KB
testcase_17 AC 140 ms
106,628 KB
testcase_18 AC 145 ms
106,856 KB
testcase_19 AC 144 ms
106,632 KB
testcase_20 AC 117 ms
91,028 KB
testcase_21 AC 116 ms
91,036 KB
testcase_22 AC 117 ms
91,136 KB
testcase_23 AC 92 ms
71,220 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys, math
input = lambda: sys.stdin.readline()[:-1]
def MI(): return map(int, input().split())
inf = 10**18
from collections import *

n,k = MI()
a = list(MI())

cnt = Counter(a)
cnt = sorted(cnt.items(), key=lambda x:x[1], reverse=True)

now = 0
ans = 0
for key, value in cnt:
    if now >= k:
        break
    now += value
    ans += 1
print(ans)
0