Cod sursa(job #2701933)

Utilizator tomaionutIDorando tomaionut Data 2 februarie 2021 12:09:29
Problema Statistici de ordine Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.3 kb
#include <bits/stdc++.h>
using namespace std;
ifstream fin("sdo.in");
ofstream fout("sdo.out");
int n, k, a[3000005];
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;
}