Pagini recente » Cod sursa (job #2750816) | Cod sursa (job #576991) | Cod sursa (job #1902745) | Cod sursa (job #2714823) | Cod sursa (job #2607733)
#include <bits/stdc++.h>
using namespace std;
ifstream in("sdo.in");
ofstream out("sdo.out");
int n , nthElement, element;
priority_queue<int,vector<long long>,greater<int>> v;
int main(){
in >> n >> nthElement;
for(int i = 0 ; i < n ; ++i) {
in >> element;
v.push(element);
}
int i = 0;
while(v.size()) {
if(i == nthElement - 1) {
out << v.top();
return 0;
} else {
v.pop();
++i;
}
}
return 0;
}