Advertisement
Zuneve

цфваФМИФВЫпФП

Nov 1st, 2022
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <algorithm>
  4. using namespace std;
  5. int main()
  6. {
  7. int n;
  8. cin >> n;
  9. vector <int> p(n);
  10. for (int i = 0; i<n; i++) {
  11. cin >> p[i];
  12. }
  13. if (n%2==0) {
  14. cout << max(p[n/2-1],p[n/2]);
  15. } else {
  16. cout << max(min(p[n/2-1],p[n/2]), min(p[n/2],p[n/2+1]));
  17. }
  18. return 0;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement