Ankit_132

A - Blackboard List

Jun 4th, 2023
316
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.47 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. #define ll     long long
  6. #define _test   int _TEST; cin>>_TEST; while(_TEST--)
  7. #define pb     push_back
  8. #define ppb    pop_back
  9.  
  10. int main()
  11. {
  12.     _test
  13.     {
  14.         int n;
  15.         cin>>n;
  16.  
  17.         vector<ll int> a(n);
  18.         for(auto &e: a)
  19.             cin>>e;
  20.  
  21.         sort(a.begin(), a.end());
  22.  
  23.         if(a[0] >= 0)
  24.             cout<<a[n-1]<<"\n";
  25.         else
  26.             cout<<a[0]<<"\n";
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment