Facebook
From Shahnaz Esha, 1 Week ago, written in C++.
This paste is a reply to Untitled from Burly Pig - view diff
Embed
Download Paste or View Raw
Hits: 61
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int n,m,f=0;
  8.     cin>>n>>m;
  9.     if(n==m)
  10.     cout<<0;
  11.     else{
  12.     int c[m+1];
  13.     for(int i=0;i<m;i++)
  14.     cin>>c[i];
  15.     sort(c,c+m);
  16.     f=max(n-1-c[m-1],c[0]);
  17.     for(int i=m-1;i>=0;i--)
  18.         f=max(f,(c[i]-c[i-1])/2);  
  19.         cout<<f;
  20.     }
  21.    
  22.     return 0;
  23. }