SHARE
TWEET

Untitled

lalalalalalalaalalla Jun 24th, 2019 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <vector>
  3. #include <string>
  4. #include <iomanip>
  5. #include <queue>
  6. #include <cmath>
  7. #include <algorithm>
  8. #include <tuple>
  9. #include <iomanip>
  10. #include <stdio.h>
  11. #include <numeric>
  12. #include <map>
  13.  
  14. #define ll long long
  15. #define i(n) for (int i = 0; i < n; i++)
  16. #define j(n) for (int j = 0; j < n; j++)
  17. #define vi vector<int>
  18. #define vvi vector<vector<int>>
  19. #define all(a) a.begin(), a.end()
  20. #define pii pair<int, int>
  21. #define pb push_back
  22.  
  23. using namespace std;
  24.  
  25. int main()
  26. {
  27.     ios_base::sync_with_stdio(0);
  28.     cin.tie(0);
  29.     cout.tie(0);
  30.     int n;
  31.     cin >> n;
  32.     vi a(n);
  33.     i(n) cin >> a[i];
  34.     bool f;
  35.     if (n % 2) {
  36.         f = false;
  37.     } else {
  38.         f = true;
  39.     }
  40.     for (int i = 0; i < n; i++) {
  41.         for (int j = 0; j < n - i - 1; j++) {
  42.             if (f) {
  43.                 a[j] = max(a[j], a[j + 1]);
  44.             } else {
  45.                 a[j] = min(a[j], a[j + 1]);
  46.             }
  47.         }
  48.         f = !f;
  49. //        j(n) {
  50. //            cout << a[j] << " ";
  51. //        }
  52. //        cout<<"\n";
  53.     }
  54.     cout << a[0];
  55. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top