Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define ll long long
- #define _test int _TEST; cin>>_TEST; while(_TEST--)
- #define pb push_back
- #define ppb pop_back
- int main()
- {
- _test
- {
- int n;
- cin>>n;
- vector<ll int> a(n);
- for(auto &e: a)
- cin>>e;
- sort(a.begin(), a.end());
- if(a[0] >= 0)
- cout<<a[n-1]<<"\n";
- else
- cout<<a[0]<<"\n";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment