Cod sursa(job #1690280)
| Utilizator | Data | 14 aprilie 2016 22:25:22 | |
|---|---|---|---|
| Problema | Statistici de ordine | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.43 kb |
#include <iostream>
#include <fstream>
#include <algorithm>
using namespace std;
ifstream fin ("sdo.in");
ofstream fout ("sdo.out");
const int nmax = 3e6+5;
int v[nmax];
int main() {
ios_base::sync_with_stdio(false);
int n, x, i;
fin >> n >> x;
for(i=1; i<=n; i++)
fin >> v[i];
nth_element(v+1, v+x, v+n+1);
fout << v[x] << "\n";
fin.close();
fout.close();
return 0;
}
