結果
| 問題 | No.2334 Distinct Cards |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-01-13 00:05:00 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 21 ms / 2,000 ms |
| コード長 | 445 bytes |
| 記録 | |
| コンパイル時間 | 1,399 ms |
| コンパイル使用メモリ | 216,556 KB |
| 実行使用メモリ | 6,528 KB |
| 最終ジャッジ日時 | 2026-07-03 10:21:01 |
| 合計ジャッジ時間 | 2,693 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 22 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(void){
int n, k;
cin >> n >> k;
vector<int> ct(n);
int a;
for (int i = 0; i < n; i++) {
cin >> a;
ct[a-1]++;
}
sort(ct.rbegin(), ct.rend());
int sum = 0, ans = 0;
for (int i = 0; i < n; i++) {
sum += ct[i];
if (ct[i] != 0) ans++;
if (sum >= k) {
break;
}
}
cout << ans << endl;
}