Cod sursa(job #2557317)
Utilizator | Data | 25 februarie 2020 18:48:06 | |
---|---|---|---|
Problema | Statistici de ordine | Scor | 50 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.29 kb |
#include <fstream>
#include <algorithm>
using namespace std;
ifstream f("sdo.in");
ofstream g("sdo.out");
int n, k, i;
int v[3000001];
int main()
{
f >> n >> k;
for (i=1; i<=n; i++)
f >> v[i];
nth_element(v+1, v+k+1, v+n+1);
g << v[k];
return 0;
}