結果
| 問題 | No.2334 Distinct Cards |
| コンテスト | |
| ユーザー |
detteiuu
|
| 提出日時 | 2026-07-22 02:35:28 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 137 ms / 2,000 ms |
| + 627µs | |
| コード長 | 293 bytes |
| 記録 | |
| コンパイル時間 | 244 ms |
| コンパイル使用メモリ | 96,488 KB |
| 実行使用メモリ | 123,336 KB |
| 最終ジャッジ日時 | 2026-07-22 02:35:34 |
| 合計ジャッジ時間 | 4,379 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 22 |
ソースコード
from collections import defaultdict
N, K = map(int, input().split())
A = sorted(map(int, input().split()))
D = defaultdict(int)
for a in A:
D[a] += 1
D = sorted([(n, c) for n, c in D.items()], key=lambda x:x[1], reverse=True)
B = []
for n, c in D:
B += [n]*c
print(len(set(B[:K])))
detteiuu