Cod sursa(job #2272209)
Utilizator | Data | 29 octombrie 2018 20:36:55 | |
---|---|---|---|
Problema | Statistici de ordine | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.32 kb |
#include <bits/stdc++.h>
#include <fstream>
using namespace std;
ifstream f("sdo.in");
ofstream g("sdo.out");
vector <int> v;
int main()
{
int n,k,x;
f>>n>>k;
for(int i=0;i<n;i++)
f>>x,v.push_back(x);
nth_element(v.begin(),v.begin()+k-1,v.end());
g<<v[k-1];
return 0;
}