結果
| 問題 |
No.2334 Distinct Cards
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-01-23 16:57:13 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 353 bytes |
| コンパイル時間 | 2,184 ms |
| コンパイル使用メモリ | 203,812 KB |
| 最終ジャッジ日時 | 2025-02-18 22:25:59 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 RE * 1 |
| other | AC * 4 WA * 8 RE * 10 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,k;
cin >> n >> k;
map<int,int> m;
for(int i = 0;i < n;i++){
int a;
cin >> a;
m[a]++;
}
vector<int> b;
for(auto [key,value] : m){
b.push_back(value);
}
sort(b.begin(),b.end());
int s = n - 1;
int ans = 0;
while(k){
k -= b[s];
s--;
ans++;
}
cout << ans << endl;
}