Pagini recente » Cod sursa (job #2523100) | Cod sursa (job #2185633) | Cod sursa (job #954182) | Cod sursa (job #1449475) | Cod sursa (job #3326235)
#include <bits/stdc++.h>
/// i love alex stan so much ///
/// i love alex stan so much ///
/// i love alex stan so much ///
/// i love alex stan so much ///
/// i love alex stan so much ///
/// i love alex stan so much ///
/// i love alex stan so much ///
/// i love alex stan so much ///
/// i love alex stan so much ///
/// i love alex stan so much ///
/// i love alex stan so much ///
/// i love alex stan so much ///
/// i love alex stan so much ///
/// i love alex stan so much ///
/* /\ _____ _____ _______ /\ |\ |
/ \ | | \ / / | / \ | \ |
/----\ | |-- \/ \_____ | /----\ | \ |
/ \ | | /\ \ | / \ | \ |
/ \ |____ |____ / \ ______/ | / \ | \|
████████▀▀░░░░░░░░░░░░░░░░░░░▀▀███████
██████▀░░░░░░░░░░░░░░░░░░░░░░░░░▀██████
█████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█████
████░░░░░▄▄▄▄▄▄▄░░░░░░░░▄▄▄▄▄▄░░░░░████
████░░▄██████████░░░░░░██▀░░░▀██▄░░████
████░░███████████░░░░░░█▄░░▀░░▄██░░████
█████░░▀▀███████░░░██░░░██▄▄▄█▀▀░░█████
██████░░░░░░▄▄▀░░░████░░░▀▄▄░░░░░██████
█████░░░░░█▄░░░░░░▀▀▀▀░░░░░░░█▄░░░█████
█████░░░▀▀█░█▀▄▄▄▄▄▄▄▄▄▄▄▄▄▀██▀▀░░█████
██████░░░░░▀█▄░░█░░█░░░█░░█▄▀░░░░██▀▀▀▀
▀░░░▀██▄░░░░░░▀▀█▄▄█▄▄▄█▄▀▀░░░░▄█▀░░░▄▄
▄▄▄░░░▀▀██▄▄▄▄░░░░░░░░░░░░▄▄▄███░░░▄██▄
██████▄▄░░▀█████▀█████▀██████▀▀░░▄█████
██████████▄░░▀▀█▄░░░░░▄██▀▀▀░▄▄▄███▀▄██*/
using namespace std;
ifstream fin ("sdo.in");
ofstream fout ("sdo.out");
int n, k, st, dr, mij, rez;
int a[3000005];
int check(int nr){
int cnt = 0;
for(int i = 1; i <= n; i++){
if(a[i] <= nr){
cnt++;
}
}
return cnt;
}
int main()
{
fin >> n >> k;
for(int i = 1; i <= n; i++){ fin >> a[i]; }
st = 1;
dr = INT_MAX;
while(st <= dr){
mij = (st + dr) / 2;
if(check(mij) >= k){
rez = mij;
dr = mij - 1;
}
else{
st = mij + 1;
}
}
fout << rez;
return 0;
}