Advertisement
Saleh127

at 134C

Sep 23rd, 2020
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. #define test int t; cin>>t; for(int cs=1;cs<=t;cs++)
  5. ll n,a[200005],c[200005],d,e,i,j,k,l;
  6. int main()
  7. {
  8. ios_base::sync_with_stdio(0);
  9. cin.tie(0);cout.tie(0);
  10.  
  11. cin>>n;
  12. for(i=0;i<n;i++)
  13. {
  14. cin>>a[i];
  15. c[i]=a[i];
  16. }
  17.  
  18. sort(c,c+n);
  19. for(i=0;i<n;i++)
  20. {
  21. if(a[i]==c[n-1]) cout<<c[n-2]<<endl;
  22. else cout<<c[n-1]<<endl;
  23. }
  24. return 0;
  25. }
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement