Cod sursa(job #2308948)

Utilizator justsomedudePalade Thomas-Emanuel justsomedude Data 28 decembrie 2018 02:41:35
Problema Statistici de ordine Scor 0
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.69 kb
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <iostream>
#include <fstream>
#include <algorithm>
ifstream fin ("sdo.in");
ofstream fout ("sdo.out");

using namespace std;

int main()
{
    int n, k, a[3000002];
    fin >> n >> k;
    for (int i = 0; i < n; i++)
        fin >> a[i];

    nth_element(a, a+k, a+n);

    fout << a[++k] << "\n";
    return 0;
}