A. Lineland Mail-水题-Codeforces Round #Pi (Div. 2)



#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <algorithm>
#include <iostream>
#include <queue>
#include <map>
#include <set>
#include <vector>
using namespace std;
 

__int64 tm[100000+5];

int main()
{  
	__int64 n,i;

	scanf("%I64d",&n);
	for (i=1;i<=n;i++)
	{
		scanf("%I64d",&tm[i]);
	}

	
	for (i=1;i<=n;i++)
	{
			__int64 maxx=0;
			maxx=__max ( abs(tm[i]-tm[1]),abs(tm[i]-tm[n]));
			__int64 minn=1000000000;
			if (i==1) minn=tm[2]-tm[1];
			else
				if (i==n)
					minn= tm[n]-tm[n-1];
				else
			minn=__min( abs(tm[i]-tm[i-1]),abs(tm[i]-tm[i+1])  );
				printf("%I64d %I64d\n",minn,maxx);
	}
 
	
	return 0;
	
}


你可能感兴趣的:(A. Lineland Mail-水题-Codeforces Round #Pi (Div. 2))