Pagini recente » Cod sursa (job #2113363) | Cod sursa (job #1674298) | Istoria paginii runda/14_martie_simulare_oji_2024_clasele_11_12/clasament | Cod sursa (job #171171) | Cod sursa (job #2152350)
#include <iostream>
#include <fstream>
#include <algorithm>
#include <iomanip>
using namespace std;
ifstream fin("sdo.in");
ofstream fout("sdo.out");
const int NLIM = 3e6+10;
int n, k;
int x[NLIM];
int main()
{
ios::sync_with_stdio(false);
fin >> n >> k;
for(int i = 0; i < n; ++i)
fin >> x[i];
nth_element(x, x + k-1, x + n-1);
/**
for(int i = 0; i < n; ++i)
cout << x[i] << " ";
cout << "\n";
/**/
fout << x[k-1] << "\n";
return 0;
}