Cod sursa(job #3137269)
Utilizator | Data | 11 iunie 2023 23:35:26 | |
---|---|---|---|
Problema | Statistici de ordine | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.45 kb |
#include <bits/stdc++.h>
#define DIM 3000001
using namespace std;
ifstream fin("sdo.in");
ofstream fout("sdo.out");
int v[DIM];
int 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;
}