Cod sursa(job #2471748)

Utilizator MatteoalexandruMatteo Verzotti Matteoalexandru Data 11 octombrie 2019 13:16:53
Problema Statistici de ordine Scor 0
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 1.34 kb
/*
                `-/oo+/-   ``
              .oyhhhhhhyo.`od
             +hhhhyyoooos. h/
            +hhyso++oosy- /s
           .yoooossyyo:``-y`
            ..----.` ``.-/+:.`
                   `````..-::/.
                  `..```.-::///`
                 `-.....--::::/:
                `.......--::////:
               `...`....---:::://:
             `......``..--:::::///:`
            `---.......--:::::////+/`
            ----------::::::/::///++:
            ----:---:::::///////////:`
            .----::::::////////////:-`
            `----::::::::::/::::::::-
             `.-----:::::::::::::::-
               ...----:::::::::/:-`
                 `.---::/+osss+:`
                   ``.:://///-.
*/
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <cmath>
#define INF 0x3f3f3f3f
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#define MAX(a, b) (((a) < (b)) ? (b) : (a))

using namespace std;

int v[3000005];

int main()
{
    //freopen("sdo.in","r",stdin);
    //freopen("sdo.out","w",stdout);
    int n, k;
    scanf("%d%d", &n, &k);
    for(int i = 1; i <= n; i++) scanf("%d", &v[i]);
    nth_element(v + 1, v + k + 1, v + n + 1);
    printf("%d\n", v[k]);
    return 0;
}