Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <math.h>
- #include <string.h>
- #include <ctype.h>
- #pragma warning(disable:4996)
- typedef long long s64, LL;
- typedef unsigned long long u64, ULL;
- typedef const void *cvp;
- #define MAX(a,b) (((a)>(b))?(a):(b))
- int cmpi32(const void *p, const void *q){
- int a = *((int *)p), b = *((int *)q);
- if(a > b)return 1;
- else if(a < b)return -1;
- else return 0;
- }
- int arr[1919810] = { 0 };
- int main(){
- #ifdef _DEBUG
- FILE *fp = freopen("../../../input.txt", "r", stdin);
- //FILE *fp2 = freopen("../../../output.txt", "w", stdout);
- #endif // _DEBUG
- int n, m, i, t;
- scanf("%d%d", &n, &m);
- for(i = 0; i < m; i++){
- scanf("%d", arr + i);
- }
- qsort(arr, m, sizeof(int), cmpi32);
- t = MAX(arr[0] - 1, n - arr[m - 1]);
- for(i = 1; i < m; i++){
- t = MAX(t, (arr[i] - arr[i - 1]) / 2);
- }
- printf("%d\n", t + 1);
- #ifdef _DEBUG
- fp = freopen("CON", "r", stdin);
- //fp2 = freopen("CON", "w", stdout);
- system("pause");
- #endif // _DEBUG
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment