結果

問題 No.2334 Distinct Cards
ユーザー 倉
提出日時 2023-06-02 22:01:47
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 155 ms / 2,000 ms
コード長 693 bytes
コンパイル時間 1,317 ms
コンパイル使用メモリ 86,964 KB
実行使用メモリ 106,712 KB
最終ジャッジ日時 2023-08-28 03:30:14
合計ジャッジ時間 5,099 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 105 ms
72,904 KB
testcase_01 AC 105 ms
72,812 KB
testcase_02 AC 106 ms
72,896 KB
testcase_03 AC 106 ms
72,996 KB
testcase_04 AC 107 ms
72,960 KB
testcase_05 AC 105 ms
72,924 KB
testcase_06 AC 108 ms
73,024 KB
testcase_07 AC 106 ms
73,016 KB
testcase_08 AC 108 ms
72,868 KB
testcase_09 AC 107 ms
73,008 KB
testcase_10 AC 108 ms
73,008 KB
testcase_11 AC 108 ms
73,080 KB
testcase_12 AC 154 ms
100,952 KB
testcase_13 AC 153 ms
100,912 KB
testcase_14 AC 155 ms
100,912 KB
testcase_15 AC 154 ms
100,852 KB
testcase_16 AC 153 ms
101,076 KB
testcase_17 AC 149 ms
106,164 KB
testcase_18 AC 150 ms
106,400 KB
testcase_19 AC 153 ms
106,712 KB
testcase_20 AC 130 ms
90,872 KB
testcase_21 AC 131 ms
91,380 KB
testcase_22 AC 129 ms
91,180 KB
testcase_23 AC 108 ms
72,968 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter
import sys
from functools import partial
# import pypyjit
# pypyjit.set_param('max_unroll_recursion = -1')

sys.setrecursionlimit(500005)
stdin = sys.stdin

ns = lambda: stdin.readline().strip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nz = lambda: list(map(lambda x: int(x)-1, stdin.readline().split())) # 遅い
printa = partial(print, sep="\n") # printa(*A) で各要素を改行して出力
mod = 1000000007 # 998244353
inf = 10 ** 18

N, K = na()
A = na()

C = Counter(A)

B = [c for c in C.values()]
B.sort(reverse=True)

agg = 0
for i, b in enumerate(B):
    agg += b
    if agg >= K:
        print(i+1)
        exit()
0