結果
| 問題 |
No.2334 Distinct Cards
|
| コンテスト | |
| ユーザー |
tsunamayo123
|
| 提出日時 | 2023-06-14 21:44:32 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 15 ms / 2,000 ms |
| コード長 | 1,486 bytes |
| コンパイル時間 | 3,783 ms |
| コンパイル使用メモリ | 232,684 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-23 03:33:11 |
| 合計ジャッジ時間 | 5,216 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 22 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
#define FOR(i,l,r) for(int i=(l);i<(r);++i)
#define rep(i,n) FOR(i,0,n)
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<long long,long long>;
#define pf push_front
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define sz(x) ((int)x.size())
#define pqueue priority_queue
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
#define INF (1LL<<30)-1
const int mod = 1000000007;
#define pcnt __builtin_popcount
#define bit(n) (1LL<<(n))
#define UNIQUE(v) v.erase(unique(v.begin(),v.end()),v.end());
template<typename T> void out(T vec){for(int c:vec)cout<<c<<' ';}
void yn(bool flag){if(flag)cout<<"Yes"<<'\n'; else cout<<"No"<<'\n';}
#ifdef LOCAL
# include "debug_print.hpp"
# define debug(...) debug_print::multi_print(#__VA_ARGS__, __VA_ARGS__)
#else
# define debug(...) (static_cast<void>(0))
#endif
//------------------------------------------------------------------//
void solve(){
int N,K; cin>>N>>K;
vector<int> cnt(N);
rep(i,N){
int A; cin>>A;
cnt[A-1]++;
}
sort(rall(cnt));
int c=0,pos=0;
while(c<K){
c+=cnt[pos];
pos++;
}
cout<<pos<<endl;
}
signed main(){
cin.tie(0); ios::sync_with_stdio(0);
cout<<fixed<<setprecision(10);
solve();
}
tsunamayo123