Rating:- | #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #define rnt rsgister int #define min(x,y) (x)>(y)?(y):(x) #define max(x,y) (x)<(y)?(y):(x) using namespace std; int n,m; int mp[100001]; int main() { int ans=0,t; cin>>n ; long long max1,min1; for(int i=1;i<=n;i++)cin>>mp[i]; sort(mp+1,mp+n+1); for(int i=1;i<=n;i++) { max1=0,min1=0x3f3f3f3f; if(i!=n) min1=min(min1,mp[i+1]-mp[i]); max1=max(max1,mp[n]-mp[i]); max1=max(max1,mp[i]-mp[1]); if(i!=1) min1=min(min1,mp[i]-mp[i-1]); cout<<min1<<' '<<max1<<endl; } } |