結果
| 問題 | No.2334 Distinct Cards |
| コンテスト | |
| ユーザー |
shobonvip
|
| 提出日時 | 2023-06-02 21:52:39 |
| 言語 | C++17 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 24 ms / 2,000 ms |
| + 873µs | |
| コード長 | 497 bytes |
| 記録 | |
| コンパイル時間 | 3,280 ms |
| コンパイル使用メモリ | 277,336 KB |
| 実行使用メモリ | 9,872 KB |
| 最終ジャッジ日時 | 2026-10-15 07:47:54 |
| 合計ジャッジ時間 | 5,492 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 23 |
ソースコード
#include<bits/stdc++.h>
#include<atcoder/all>
using namespace std;
using namespace atcoder;
typedef modint998244353 mint;
typedef long long ll;
int main(){
int n, k; cin >> n >> k;
vector<int> bucket(n+1);
for (int i=0; i<n; i++){
int a; cin >> a;
bucket[a]++;
}
sort(bucket.begin(), bucket.end());
reverse(bucket.begin(), bucket.end());
int piv = 0;
int ans = 1;
for (int i=0; i<k; i++){
if (bucket[piv] == 0){
piv++;
ans++;
}
bucket[piv]--;
}
cout << ans << endl;
}
shobonvip