Cod sursa(job #1503377)
| Utilizator | Data | 15 octombrie 2015 23:58:27 | |
|---|---|---|---|
| Problema | Statistici de ordine | Scor | 40 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.44 kb |
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
#ifdef LOCAL
freopen("input", "r", stdin);
#else
ifstream cin("sdo.in");
ofstream cout("sdo.out");
#endif // LOCAL
int n, k;
cin >> n >> k;
vector<int> a(n);
for (int i = 0; i < n; ++i) {
cin >> a[i];
}
nth_element(a.begin(), a.begin() + k, a.end());
cout << a[k - 1];
return 0;
}
