Pagini recente » Cod sursa (job #3235940) | Cod sursa (job #156330) | Cod sursa (job #2626515) | Cod sursa (job #67066) | Cod sursa (job #1690280)
#include <iostream>
#include <fstream>
#include <algorithm>
using namespace std;
ifstream fin ("sdo.in");
ofstream fout ("sdo.out");
const int nmax = 3e6+5;
int v[nmax];
int main() {
ios_base::sync_with_stdio(false);
int n, x, i;
fin >> n >> x;
for(i=1; i<=n; i++)
fin >> v[i];
nth_element(v+1, v+x, v+n+1);
fout << v[x] << "\n";
fin.close();
fout.close();
return 0;
}