結果
| 問題 | No.2334 Distinct Cards |
| コンテスト | |
| ユーザー |
koheijkt
|
| 提出日時 | 2026-05-28 22:09:36 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 98 ms / 2,000 ms |
| コード長 | 421 bytes |
| 記録 | |
| コンパイル時間 | 217 ms |
| コンパイル使用メモリ | 85,632 KB |
| 実行使用メモリ | 103,552 KB |
| 最終ジャッジ日時 | 2026-05-28 22:09:42 |
| 合計ジャッジ時間 | 2,976 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
| 純コード判定待ち |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 22 |
ソースコード
N, K = map(int, input().split())
A = list(map(int, input().split()))
cnt = [0]*(N + 1)
for a in A:
cnt[a] += 1
data = []
for i in range(1, N + 1):
if cnt[i] != 0:
data.append((cnt[i], i))
data.sort()
total = 0
distinct_nums = 0
while data:
c, num = data.pop()
if total + c < K:
distinct_nums += 1
total += c
else:
distinct_nums += 1
break
print(distinct_nums)
koheijkt