結果

問題 No.2334 Distinct Cards
ユーザー hir355hir355
提出日時 2023-06-02 21:22:28
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 163 ms / 2,000 ms
コード長 259 bytes
コンパイル時間 865 ms
コンパイル使用メモリ 86,688 KB
実行使用メモリ 106,756 KB
最終ジャッジ日時 2023-08-28 02:36:01
合計ジャッジ時間 4,297 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 91 ms
71,680 KB
testcase_01 AC 92 ms
71,432 KB
testcase_02 AC 97 ms
71,396 KB
testcase_03 AC 94 ms
71,488 KB
testcase_04 AC 92 ms
71,644 KB
testcase_05 AC 92 ms
71,472 KB
testcase_06 AC 93 ms
71,304 KB
testcase_07 AC 92 ms
71,500 KB
testcase_08 AC 93 ms
71,648 KB
testcase_09 AC 95 ms
71,604 KB
testcase_10 AC 93 ms
71,372 KB
testcase_11 AC 94 ms
71,436 KB
testcase_12 AC 163 ms
101,012 KB
testcase_13 AC 161 ms
101,032 KB
testcase_14 AC 158 ms
101,072 KB
testcase_15 AC 159 ms
100,888 KB
testcase_16 AC 159 ms
101,108 KB
testcase_17 AC 141 ms
106,592 KB
testcase_18 AC 145 ms
106,552 KB
testcase_19 AC 146 ms
106,756 KB
testcase_20 AC 117 ms
90,740 KB
testcase_21 AC 117 ms
91,228 KB
testcase_22 AC 118 ms
90,760 KB
testcase_23 AC 92 ms
71,652 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter
n, k = map(int, input().split())
a = list(map(int, input().split()))
c = Counter(a)
x = sorted(c.items(), key=lambda x:-x[1])
t = 0
ans = 0
for a, b in x:
    ans += 1
    t += b
    if t >= k:
        print(ans)
        break
0