Cod sursa(job #3137268)
Utilizator | Data | 11 iunie 2023 23:34:54 | |
---|---|---|---|
Problema | Statistici de ordine | Scor | 50 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.46 kb |
#include <bits/stdc++.h>
#define DIM 500001
using namespace std;
ifstream fin("sdo.in");
ofstream fout("sdo.out");
long long v[DIM];
long long n, i, k;
int main(){
ios :: sync_with_stdio(false);
fin.tie(0);
fout.tie(0);
fin >> n >> k;
for(i=1;i<=n;i++)
fin >> v[i];
size_t sol = k;
nth_element(v + 1, v + sol, v + n + 1);
fout << v[sol];
fin.close();
fout.close();
return 0;
}