結果
| 問題 | No.2334 Distinct Cards |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-01-23 16:57:45 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 365 bytes |
| 記録 | |
| コンパイル時間 | 1,335 ms |
| コンパイル使用メモリ | 222,004 KB |
| 実行使用メモリ | 8,704 KB |
| 最終ジャッジ日時 | 2026-07-03 12:02:15 |
| 合計ジャッジ時間 | 3,763 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 RE * 1 |
| other | AC * 15 RE * 7 |
ソースコード
#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 = (int)b.size() - 1;
int ans = 0;
while(k){
k -= b[s];
s--;
ans++;
}
cout << ans << endl;
}