Cod sursa(job #573023)

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

using namespace std;

int N, K, A[3000005];

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 + 1);
    out << A[K];
    return 0;
}