Cod sursa(job #1220471)
Utilizator | Data | 17 august 2014 14:31:59 | |
---|---|---|---|
Problema | Statistici de ordine | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.35 kb |
#include <fstream>
#include <algorithm>
using namespace std;
ifstream fin("sdo.in");
ofstream fout("sdo.out");
const int MAXN = 3000005;
int N, K, V[MAXN];
void read()
{
fin >> N >> K;
for(int i = 1; i <= N; i++)
fin >> V[i];
nth_element(V+1, V+K, V+N+1);
fout << V[K] << "\n";
}
int main()
{
read();
return 0;
}