Cod sursa(job #1612604)
Utilizator | Data | 24 februarie 2016 22:35:25 | |
---|---|---|---|
Problema | Statistici de ordine | Scor | 40 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.41 kb |
#include <cstdio>
#include <algorithm>
using namespace std;
const int NMAX = 3000010;
int N, K;
int v[NMAX];
int main () {
freopen ("sdo.in", "r", stdin);
freopen ("sdo.out", "w", stdout);
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;
}