Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- #define forn(i,n) for(i=0;i<n;++i)
- using namespace std;
- int main()
- {
- ios::sync_with_stdio(false);
- cin.tie();
- //freopen("input.txt","r",stdin);
- //freopen("output.txt","w",stdout);
- int n,k;
- cin>>n>>k;
- int a[n],i;
- forn(i,n)
- cin>>a[i];
- nth_element(a,a+k,a+n);
- cout<<a[k];
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement