Water The Garden
#pragma comment(linker, "/STACK:102400000,102400000") #include<stdio.h> #include<string.h> #include<stdlib.h> #include<vector> #include<algorithm> #include<iostream> #include<map> #include<queue> #include<stack> #include<string> #include<functional> #include<math.h> //#include<bits/stdc++.h> using namespace std; typedef long long lint; typedef vector<int> VI; typedef pair<int, int> PII; typedef queue<int> QI; void makedata() { freopen("input.txt", "w", stdout); fclose(stdout); } int x[300]; int main() { #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); #endif //makedata(); std::ios::sync_with_stdio(0), cin.tie(0); int n, k, t; cin >> t; while (t--) { cin >> n >> k; int ans = 0; for (int i = 0; i < k; i++) cin >> x[i]; ans = max(ans, x[0]); ans = max(ans, n - x[k - 1] + 1); for (int i = 1; i < k; i++) ans = max(ans, (x[i] - x[i - 1] + 2) / 2); cout << ans << endl; } return 0; }