Cod sursa(job #2774921)
Utilizator | Data | 13 septembrie 2021 15:46:44 | |
---|---|---|---|
Problema | Statistici de ordine | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.33 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream fin("sdo.in");
ofstream fout("sdo.out");
int N, k;
vector<int>v;
int main() {
fin >> N >> k;
v = vector<int>(N);
for(auto &it: v) {
fin >> it;
}
nth_element(v.begin(), v.begin() + k - 1, v.end());
fout << v[k - 1] << '\n';
return 0;
}