SHARE
TWEET

Untitled

lalalalalalalaalalla Jun 24th, 2019 51 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 = true;
  35.     while (a.size() != 1) {
  36.         vi b;
  37.         i(a.size() - 1) {
  38.             if (f) {
  39.                 b.pb(max(a[i], a[i + 1]));
  40.             } else {
  41.                 b.pb(min(a[i], a[i + 1]));
  42.             }
  43.         }
  44.         a = b;
  45.         f = !f;
  46. //        i(a.size()) cout << a[i] << " ";
  47. //        cout << "\n";
  48.     }
  49.     cout << a[0];
  50. }
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