CF567A.Lineland Mail

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

All cities of Lineland are located on the OxOx coordinate axis. Thus, each city is associated with its position xix_{i} — a coordinate on the OxOx axis. No two cities are located at a single point.

Lineland residents love to send letters to each other. A person may send a letter only if the recipient lives in another city (because if they live in the same city, then it is easier to drop in).

Strange but true, the cost of sending the letter is exactly equal to the distance between the sender's city and the recipient's city.

For each city calculate two values ​​ minimin_{i} and maximax_{i} , where minimin_{i} is the minimum cost of sending a letter from the ii -th city to some other city, and maximax_{i} is the the maximum cost of sending a letter from the ii -th city to some other city

输入格式

The first line of the input contains integer nn ( 2<=n<=1052<=n<=10^{5} ) — the number of cities in Lineland. The second line contains the sequence of nn distinct integers x1,x2,...,xnx_{1},x_{2},...,x_{n} ( 109<=xi<=109-10^{9}<=x_{i}<=10^{9} ), where xix_{i} is the xx -coordinate of the ii -th city. All the xix_{i} 's are distinct and follow in ascending order.

输出格式

Print nn lines, the ii -th line must contain two integers mini,maximin_{i},max_{i} , separated by a space, where minimin_{i} is the minimum cost of sending a letter from the ii -th city, and maximax_{i} is the maximum cost of sending a letter from the ii -th city.

输入输出样例

  • 输入#1

    4
    -5 -2 2 7
    

    输出#1

    3 12
    3 9
    4 7
    5 12
    
  • 输入#2

    2
    -1 1
    

    输出#2

    2 2
    2 2
    
首页