結果

問題 No.2334 Distinct Cards
ユーザー daiota
提出日時 2023-06-02 21:42:00
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 447 bytes
コンパイル時間 1,980 ms
コンパイル使用メモリ 172,616 KB
実行使用メモリ 8,064 KB
最終ジャッジ日時 2024-12-28 16:59:43
合計ジャッジ時間 2,977 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 8 WA * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int,int> P;
#define REP(i,n) for(int i=0;i<int(n);i++)


int main(void){
	cin.tie(nullptr);  ios_base::sync_with_stdio(false);
	int i,j,k;

	int N,K;
	cin >> N >> K;
	map<int,int> m;
	for(i=1;i<=N;i++){
		int a;
		cin >> a;
		a*=-1;
		m[a]++;
	}

	int ans=0,s=0;
	for(auto x : m){
		ans++;
		s+=x.second;
		if(s>=K) break;
	}

	cout << ans << endl;


	return 0;
}
0