CF792A.New Bus Route

普及/提高-

通过率:0%

AC君温馨提醒

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

题目描述

There are nn cities situated along the main road of Berland. Cities are represented by their coordinates — integer numbers a1,a2,...,ana_{1},a_{2},...,a_{n} . All coordinates are pairwise distinct.

It is possible to get from one city to another only by bus. But all buses and roads are very old, so the Minister of Transport decided to build a new bus route. The Minister doesn't want to spend large amounts of money — he wants to choose two cities in such a way that the distance between them is minimal possible. The distance between two cities is equal to the absolute value of the difference between their coordinates.

It is possible that there are multiple pairs of cities with minimal possible distance, so the Minister wants to know the quantity of such pairs.

Your task is to write a program that will calculate the minimal possible distance between two pairs of cities and the quantity of pairs which have this distance.

输入格式

The first line contains one integer number nn ( 2<=n<=21052<=n<=2·10^{5} ).

The second line contains nn integer numbers a1,a2,...,ana_{1},a_{2},...,a_{n} ( 109<=ai<=109-10^{9}<=a_{i}<=10^{9} ). All numbers aia_{i} are pairwise distinct.

输出格式

Print two integer numbers — the minimal distance and the quantity of pairs with this distance.

输入输出样例

  • 输入#1

    4
    6 -3 0 4
    

    输出#1

    2 1
    
  • 输入#2

    3
    -2 0 2
    

    输出#2

    2 2
    

说明/提示

In the first example the distance between the first city and the fourth city is 46=2|4-6|=2 , and it is the only pair with this distance.

首页