結果

問題 No.2334 Distinct Cards
ユーザー れいん
提出日時 2025-05-07 15:45:56
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 366 bytes
コンパイル時間 3,636 ms
コンパイル使用メモリ 282,836 KB
実行使用メモリ 12,928 KB
最終ジャッジ日時 2025-05-07 15:46:05
合計ジャッジ時間 7,837 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other WA * 4 TLE * 1 -- * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main()
{
    int N, K;
    cin >> N >> K;
    vector<int> A(N + 1);
    for (int i = 0; i < N; i++)
    {
        int a;
        cin >> a;
        A[a]++;
    }
    sort(A.rbegin(), A.rend());
    int now = 0;
    int ans = 0;
    while (now < K)
    {
        now += A[now];
        ans++;
    }
    cout << ans;
}
0