Advertisement
Saleh127

CF 977C

Jul 30th, 2020
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5. ios_base::sync_with_stdio(0);
  6. cin.tie(0);cout.tie(0);
  7.  
  8. int a[200000],c,d=0,e=0,f,i,j,k,l;
  9. cin>>c>>k;
  10. a[0]=1;
  11. for(i=1;i<=c;i++)
  12. {
  13. cin>>a[i];
  14. }
  15. sort(a,a+c+1);
  16. if(a[k+1]!=a[k])
  17. {
  18. cout<<a[k]<<endl;
  19. }
  20. else cout<<-1<<endl;
  21. return 0;
  22. }
  23.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement