Cod sursa(job #2384283)

Utilizator AlexandruGabrielAliciuc Alexandru AlexandruGabriel Data 20 martie 2019 16:31:24
Problema Statistici de ordine Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.31 kb
#include <bits/stdc++.h>

using namespace std;

ifstream fin ("sdo.in");
ofstream fout ("sdo.out");

unsigned int n, k, a[3000001];

int main()
{
    fin >> n >> k;
    for (int i = 1; i <= n; i++)
        fin >> a[i];
    nth_element(a + 1, a + k, a + n + 1);
    fout << a[k];
    return 0;
}