-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathq1a.cpp
More file actions
42 lines (39 loc) · 839 Bytes
/
q1a.cpp
File metadata and controls
42 lines (39 loc) · 839 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define re(i, n) for(int i = 0; i < n; i++)
#define rep(i,a,b) for(int i = (a); i <= (b); i++)
#define ren(i,a,b) for(int i = (a); i >= (b); i--)
#define si(x) scanf("%d",&x)
#define sl(x) scanf("%lld",&x)
#define ss(s) scanf("%s",s)
#define pi(x) printf("%d\n",x)
#define pl(x) printf("%lld\n",x)
#define ps(s) printf("%s\n",s)
int main()
{
std::ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int t ,n;
si(t);
int min;
while(t--)
{
min = INT_MAX;
si(n);
vector<int> v(n);
re(i ,n)
si(v[i]);
sort(v.begin() , v.end());
re(i , n-1)
{
if(min > abs(v[i] - v[i+1]))
min = abs(v[i] - v[i+1]);
}
cout << min << "\n";
}
return 0;
}