Cod sursa(job #1964887)
| Utilizator | Data | 13 aprilie 2017 19:30:10 | |
|---|---|---|---|
| Problema | Statistici de ordine | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.46 kb |
#include <iostream>
#include <algorithm>
#include <vector>
#include <fstream>
using namespace std;
ifstream in("sdo.in");
ofstream out("sdo.out");
int n,nth;
vector<int> V;
void read(){
unsigned int x;
in>>n>>nth;
for(int i=1;i<=n;i++){
in>>x;
V.push_back(x);
}
}
void solve(){
nth_element(V.begin(),V.begin()+nth-1,V.end());
out<<V[nth-1];
}
int main(){
read();
solve();
return 0;
}
