欢迎来到起遇信息学
起遇信息学正处于上线筹建阶段,以下功能已全部开放免费体验: ✅ 完整题库浏览与代码提交评测(C / C++ / Python / Java 等) ✅ 入门到进阶的系列课程试读、作业与考试 ✅ AI 提示、AI 作业分析等智能助教功能 ✅ 赛事模拟与个人能力报告 ✅ 邮箱注册开放 ⏳ 付费课程订阅与微信/支付宝支付通道 ⏳ 手机号登录,微信扫码登录、微信公众号绑定 使用中如遇任何问题,欢迎通过页面底部 **"联系我们"** 与我们沟通。
CF567A.Lineland Mail
Lineland Mail
All cities of Lineland are located on the Ox coordinate axis. Thus, each city is associated with its position x**i — a coordinate on the Ox 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 min**i and max**i, where min**i is the minimum cost of sending a letter from the i-th city to some other city, and max**i is the the maximum cost of sending a letter from the i-th city to some other city
Input
The first line of the input contains integer n (2 ≤ n ≤ 105) — the number of cities in Lineland. The second line contains the sequence of n distinct integers x1, x2, ..., x**n ( - 109 ≤ x**i ≤ 109), where x**i is the x-coordinate of the i-th city. All the x**i's are distinct and follow in ascending order.
Output
Print n lines, the i-th line must contain two integers min**i, max**i, separated by a space, where min**i is the minimum cost of sending a letter from the i-th city, and max**i is the maximum cost of sending a letter from the i-th city.
Samples
4
-5 -2 2 7
3 12
3 9
4 7
5 12
2
-1 1
2 2
2 2
在线编程 IDE
建议全屏模式获得最佳体验
| 进入全屏编程 | Alt+E |
| 递交评测 | Ctrl+Enter |
| 注释/取消注释 | Ctrl+/ |
| 缩放字体 | Ctrl+滚轮 |