Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Globalization;
- using System.IO;
- using System.Linq;
- using System.Threading;
- // (づ°ω°)づミ★゜・。。・゜゜・。。・゜☆゜・。。・゜゜・。。・゜
- public class Solver
- {
- public object Solve()
- {
- int n = ReadInt();
- int l = ReadInt();
- var a = ReadIntArray();
- Array.Sort(a);
- var b = new List<int> { -a[0] };
- b.AddRange(a);
- b.Add(2 * l - a[n - 1]);
- int ans = 0;
- for (int i = 1; i < n + 2; i++)
- ans = Math.Max(ans, b[i] - b[i - 1]);
- return (ans / 2.0).ToString(CultureInfo.InvariantCulture);
- return null;
- }
- #region Main
- protected static TextReader reader;
- protected static TextWriter writer;
- static void Main()
- {
- #if DEBUG
- reader = new StreamReader("..\\..\\input.txt");
- writer = Console.Out;
- //writer = new StreamWriter("..\\..\\output.txt");
- #else
- reader = new StreamReader(Console.OpenStandardInput());
- writer = new StreamWriter(Console.OpenStandardOutput());
- //reader = new StreamReader("numbers.in");
- //writer = new StreamWriter("numbers.out");
- #endif
- try
- {
- object result = new Solver().Solve();
- if (result != null)
- writer.WriteLine(result);
- }
- catch (Exception ex)
- {
- #if DEBUG
- Console.WriteLine(ex);
- #else
- Console.WriteLine(ex);
- throw;
- #endif
- }
- reader.Close();
- writer.Close();
- }
- #endregion
- #region Read / Write
- private static Queue<string> currentLineTokens = new Queue<string>();
- private static string[] ReadAndSplitLine()
- {
- return reader.ReadLine().Split(new[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
- }
- public static string ReadToken()
- {
- while (currentLineTokens.Count == 0)
- currentLineTokens = new Queue<string>(ReadAndSplitLine());
- return currentLineTokens.Dequeue();
- }
- public static int ReadInt()
- {
- return int.Parse(ReadToken());
- }
- public static long ReadLong()
- {
- return long.Parse(ReadToken());
- }
- public static double ReadDouble()
- {
- return double.Parse(ReadToken(), CultureInfo.InvariantCulture);
- }
- public static int[] ReadIntArray()
- {
- return ReadAndSplitLine().Select(int.Parse).ToArray();
- }
- public static long[] ReadLongArray()
- {
- return ReadAndSplitLine().Select(long.Parse).ToArray();
- }
- public static double[] ReadDoubleArray()
- {
- return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();
- }
- public static int[][] ReadIntMatrix(int numberOfRows)
- {
- int[][] matrix = new int[numberOfRows][];
- for (int i = 0; i < numberOfRows; i++)
- matrix[i] = ReadIntArray();
- return matrix;
- }
- public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)
- {
- int[][] matrix = ReadIntMatrix(numberOfRows);
- int[][] ret = new int[matrix[0].Length][];
- for (int i = 0; i < ret.Length; i++)
- {
- ret[i] = new int[numberOfRows];
- for (int j = 0; j < numberOfRows; j++)
- ret[i][j] = matrix[j][i];
- }
- return ret;
- }
- public static string[] ReadLines(int quantity)
- {
- string[] lines = new string[quantity];
- for (int i = 0; i < quantity; i++)
- lines[i] = reader.ReadLine().Trim();
- return lines;
- }
- public static void WriteArray<T>(IEnumerable<T> array)
- {
- writer.WriteLine(string.Join(" ", array));
- }
- public static void Write<T>(params T[] array)
- {
- WriteArray(array);
- }
- public static void WriteLines<T>(IEnumerable<T> array)
- {
- foreach (var a in array)
- writer.WriteLine(a);
- }
- #endregion
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement