結果
問題 | No.2334 Distinct Cards |
ユーザー |
![]() |
提出日時 | 2023-06-02 21:52:41 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 32 ms / 2,000 ms |
コード長 | 611 bytes |
コンパイル時間 | 1,199 ms |
コンパイル使用メモリ | 116,984 KB |
最終ジャッジ日時 | 2025-02-13 18:05:25 |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 22 |
ソースコード
#include <algorithm>#include <cassert>#include <cstdio>#include <cmath>#include <deque>#include <iostream>#include <map>#include <unordered_set>#include <unordered_map>#include <vector>#include <set>using namespace::std;int main() {ios::sync_with_stdio(false);int n, k;cin >> n >> k;unordered_map<int, int> c;for (int i = 0; i < n; ++i) {int a;cin >> a;++c[a];}vector<int> b;for (const auto& [_, cx] : c) b.push_back(cx);sort(b.begin(), b.end(), greater<int>());int r = 0;for (; k > 0; ++r) k -= b[r];cout << r << endl;return 0;}