-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathA_Desorting.cpp
More file actions
43 lines (43 loc) · 760 Bytes
/
Copy pathA_Desorting.cpp
File metadata and controls
43 lines (43 loc) · 760 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
43
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef pair<int, int> pi;
typedef unordered_map<ll, ll> mpp;
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define fr(i, a, b) for (int i = a; i < b; i++)
#define get(a) \
for (auto &i : a) \
cin >> i
void wushangclan()
{
int n;
cin >> n;
vl v(n);
get(v);
ll ans=INT_MAX;
fr(i, 1, n)
{
if (v[i - 1] > v[i])
{
cout << 0 << endl;
return;
}
ans=min(ans,((v[i]-v[i-1])/2LL+1LL));
}
cout<<ans<<endl;
}
int main()
{
int t;
cin >> t;
while (t--)
{
wushangclan();
}
return 0;
}