Cod sursa(job #2477711)
Utilizator | Data | 20 octombrie 2019 23:50:44 | |
---|---|---|---|
Problema | Statistici de ordine | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.37 kb |
#include <iostream>
#include <fstream>
#include <algorithm>
using namespace std;
ifstream fin("sdo.in");
ofstream fout("sdo.out");
const int nmax = 3000000;
int v[nmax + 5], n, k;
int main(){
fin >> n >> k;
for (int i = 1; i <= n; i++)
fin >> v[i];
nth_element(v + 1, v + k, v + n + 1);
fout << v[k] << '\n';
return 0;
}