Cod sursa(job #573022)

Utilizator AndrewTheGreatAndrei Alexandrescu AndrewTheGreat Data 5 aprilie 2011 20:10:12
Problema Statistici de ordine Scor 40
Compilator cpp Status done
Runda Arhiva educationala Marime 0.31 kb
#include <fstream>
#include <algorithm>

using namespace std;

int N, K, A[3000010];

int main()
{
    ifstream in("sdo.in");
    ofstream out("sdo.out");

    in>> N >> K;
    for(int i = 1; i <= N; i++)
        in>> A[i];

    nth_element(A + 1, A + K, A + N);
    out << A[K];
    return 0;
}