Cod sursa(job #2863385)

Utilizator QwertyDvorakQwerty Dvorak QwertyDvorak Data 6 martie 2022 17:21:01
Problema Statistici de ordine Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.46 kb
#include <bits/stdc++.h>
using namespace std;

#define pb push_back
#define mp make_pair
#define dbg(x) cout << #x <<": " << x << "\n";
using ll = long long;

const string myf = "sdo";
ifstream fin(myf + ".in");
ofstream fout(myf + ".out");
int n, k;
int a[3000005];
int main() {

	fin >> n >> k;
	for (int i = 1; i <= n; ++i)
		fin >> a[i];
	nth_element(a + 1, a + k, a + n + 1);
	fout << a[k] << '\n';
	fin.close();
	fout.close();
	return 0;
}