結果
問題 |
No.2334 Distinct Cards
|
ユーザー |
![]() |
提出日時 | 2023-06-03 03:12:43 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 23 ms / 2,000 ms |
コード長 | 467 bytes |
コンパイル時間 | 2,054 ms |
コンパイル使用メモリ | 197,536 KB |
最終ジャッジ日時 | 2025-02-13 22:01:46 |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 22 |
ソースコード
#define rep(i,n) for(int i=0;i<(int)(n);i++) #define ALL(v) v.begin(),v.end() typedef long long ll; #include<bits/stdc++.h> using namespace std; int main(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); int n,k; cin>>n>>k; vector<int> A(n); rep(i,n){ int a; cin>>a; a--; A[a]++; } sort(ALL(A)); reverse(ALL(A)); int ans=0; rep(i,n){ k-=A[i]; ans++; if(k<=0) break; } cout<<ans<<endl; return 0; }