fork download
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  8.  
  9. int n;
  10. long long mx = -1e18, mn = 1e18;
  11. cin >> n;
  12. for (int i = 1; i <= n; i++)
  13. {
  14. long long x;
  15. cin >> x;
  16. mx = max(mx, x);
  17. mn = min(mn, x);
  18. }
  19. cout << mx << ' ' << mn;
  20. }
Success #stdin #stdout 0.01s 5288KB
stdin
Standard input is empty
stdout
22542868892448 22542868892448