Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <algorithm>
- using namespace std;
- int main()
- {
- int n;
- cin >> n;
- vector <int> p(n);
- for (int i = 0; i<n; i++) {
- cin >> p[i];
- }
- if (n%2==0) {
- cout << max(p[n/2-1],p[n/2]);
- } else {
- cout << max(min(p[n/2-1],p[n/2]), min(p[n/2],p[n/2+1]));
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement