Cod sursa(job #2564857)
Utilizator | Data | 2 martie 2020 10:45:17 | |
---|---|---|---|
Problema | Statistici de ordine | Scor | 50 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.44 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream f("sdo.in");
ofstream g("sdo.out");
int N, K, X;
vector < int > V;
static inline void Read ()
{
f.tie(NULL);
f >> N >> K;
for(int i = 1; i <= N; ++i)
{
f >> X;
V.push_back(X);
}
return;
}
int main()
{
Read();
nth_element(V.begin(), V.begin() + K, V.end());
g << V[K - 1] << '\n';
return 0;
}