Pagini recente » Cod sursa (job #3261200) | Cod sursa (job #3278452) | Cod sursa (job #3276219) | Cod sursa (job #1949423) | Cod sursa (job #3279496)
#include <fstream>
#include <algorithm>
#include <map>
#include <vector>
using namespace std;
ifstream cin("sdo.in");
ofstream cout("sdo.out");
map <int,int,greater <int>> ma;
int n,m;
int main()
{
cin>>n>>m;
int x;
for(int i=1;i<=n;i++){
cin>>x;
ma[x]++;
}
m=n-m;
m++;
for(auto it :ma)
{
m-=it.second;
if(m<=0)
{
cout<<it.first;
return 0;
}
}
return 0;
}
//manuscrisul voinici