n, a , b = map(int, input().split())
arr = [int(c) for c in input().split()]
arr.sort()
print(arr[-a]-arr[-a-1])
/// DuongSoSad
#pragma GCC optimize(" unroll-loops")
#pragma gcc optimize("Ofast")
#pragma GCC optimization("Ofast")
#pragma optimize(Ofast)
#include <bits/stdc++.h>
#define el cout << '\n'
#define eps 0.0000001
#define maxn 2005
using namespace std;
int n , a , b , h[maxn];
void inp()
{
cin >> n >> a >> b;
for(int i = 1;i <= n; ++i) cin >> h[i];
sort(h + 1 , h + n + 1 , greater<int> ());
}
void solve()
{
int i = 1 , res = 0 , tmp;
for(;i <= a; ++i) res = h[i];
tmp = h[i];
(res == tmp) ? cout << 0 : cout << res - tmp;
}
int main()
{
ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
inp();
solve();
return 0;
}
Differences of the permutations | Doctor's Secret |
Back to School | I am Easy |
Teddy and Tweety | Partitioning binary strings |
Special sets | Smallest chosen word |
Going to office | Color the boxes |
Missing numbers | Maximum sum |
13 Reasons Why | Friend's Relationship |
Health of a person | Divisibility |
A. Movement | Numbers in a matrix |
Sequences | Split houses |
Divisible | Three primes |
Coprimes | Cost of balloons |
One String No Trouble | Help Jarvis! |
Lift queries | Goki and his breakup |
Ali and Helping innocent people | Book of Potion making |