結果

問題 No.2334 Distinct Cards
ユーザー たら
提出日時 2023-06-02 21:24:27
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 32 ms / 2,000 ms
コード長 398 bytes
コンパイル時間 1,469 ms
コンパイル使用メモリ 172,508 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-28 16:14:30
合計ジャッジ時間 2,568 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
int main() {
    int n, k;
    cin >> n >> k;
    vector<int> cnt(100100);
    for (int i = 0; i < n; ++i) {
        int a;
        cin >> a;
        cnt[a]++;
    }
    sort(cnt.rbegin(), cnt.rend());
    for (int i = 0; i < n; ++i) {
        k -= cnt[i];
        if (k <= 0) {
            cout << i + 1 << endl;
            return 0;
        }
    }
}
0