結果

問題 No.2334 Distinct Cards
ユーザー Ekiben542Ekiben542
提出日時 2023-06-03 15:28:27
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 99 ms / 2,000 ms
コード長 285 bytes
コンパイル時間 290 ms
コンパイル使用メモリ 87,040 KB
実行使用メモリ 91,108 KB
最終ジャッジ日時 2023-08-28 07:56:56
合計ジャッジ時間 3,354 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,260 KB
testcase_01 AC 68 ms
71,272 KB
testcase_02 AC 69 ms
71,328 KB
testcase_03 AC 69 ms
71,268 KB
testcase_04 AC 68 ms
71,404 KB
testcase_05 AC 67 ms
71,312 KB
testcase_06 AC 68 ms
71,132 KB
testcase_07 AC 68 ms
71,156 KB
testcase_08 AC 68 ms
71,112 KB
testcase_09 AC 69 ms
71,356 KB
testcase_10 AC 72 ms
71,124 KB
testcase_11 AC 70 ms
71,180 KB
testcase_12 AC 98 ms
90,788 KB
testcase_13 AC 99 ms
90,936 KB
testcase_14 AC 99 ms
91,032 KB
testcase_15 AC 99 ms
91,108 KB
testcase_16 AC 99 ms
90,956 KB
testcase_17 AC 91 ms
90,448 KB
testcase_18 AC 93 ms
90,932 KB
testcase_19 AC 94 ms
90,672 KB
testcase_20 AC 93 ms
90,604 KB
testcase_21 AC 92 ms
90,512 KB
testcase_22 AC 91 ms
90,532 KB
testcase_23 AC 67 ms
71,288 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,K=map(int, input().split())
cards=list(map(int, input().split()))
counts = [0]*(N + 1)
for i in range(N):
    counts[cards[i]]+=1
counts.sort(reverse=True)
total=0
num_types=0
for count in counts:
    if total>=K:
        break
    total += count
    num_types+=1
print(num_types)


0