ac代码:
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int maxn=1e5+10;
const int MAX=1e18;
ll n,a[2*maxn];
int main(){
//printf("%d\n",MAX > 0x3f3f3f3f);
while(~scanf("%I64d",&n)){
for(int i=1;i<=n;i++){
scanf("%I64d",&a[i]);
}
sort(a+1,a+1+n);
ll minn=MAX;
ll ans=MAX;
ll cnt=0;
for(int i=1;i<=n-1;i++){
ll tmp=fabs(a[i] - a[i+1]);
if( tmp < ans){
ans=tmp;
cnt=1;
}
else if(tmp == ans){
cnt++;
}
}
printf("%I64d %I64d\n",ans,cnt);
}
return 0;
}