Cod sursa(job #2088012)
| Utilizator | Data | 14 decembrie 2017 17:54:37 | |
|---|---|---|---|
| Problema | Statistici de ordine | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.48 kb |
#include <iostream>
#include <algorithm>
#include <vector>
#include <fstream>
#define ll long long
using namespace std;
const int NLIM = 3e6 + 10;
vector< int > v;
int n, k;
ifstream fcin("sdo.in");
ofstream fcout("sdo.out");
int main()
{
fcin >> n >> k;
for( int i = 0; i < n; ++i )
{
int x; fcin >> x;
v.push_back( x );
}
nth_element( v.begin(), v.begin() + k - 1, v.end() );
fcout << v[k - 1];
return 0;
}
