This page is still under construction.

Parts of this page are still being built. What you see may change.

Beach cut

Time limit1sMemory limit128 MB

Summary
Given a polyline shoreline, pick two vertices at distance at most L and connect them below the shore to maximize the enclosed beach area.
Level

Medium7 of 10

Topics
Geometry, Two pointers, Prefix sum
Solved
No attempts yet

Problem

The seashore is modeled as a polyline with no self-intersections, given by its vertices (x1,y1),(x2,y2),…,(xN,yN)(x_1, y_1), (x_2, y_2), \ldots, (x_N, y_N) listed in order, whose xx-coordinates are strictly increasing (xi<xi+1x_i < x_{i+1}). The sea lies above the polyline and the beach lies below it.

You may connect two of these vertices with a single straight segment whose length is at most LL. Choose the two vertices so that the beach area enclosed between the segment and the shore is as large as possible. The segment must never enter the sea: it may touch the shore polyline but must not cross above it.

Input

The first line contains two integers NN and LL. After that come the NN vertices as integer pairs x1 y1 x2 y2 … xN yNx_1\ y_1\ x_2\ y_2\ \ldots\ x_N\ y_N (whitespace and line breaks may separate the numbers freely).

Output

Print the maximum beach area that can be enclosed (it may be 00). Because every vertex has integer coordinates, this area is always an exact multiple of 12\frac{1}{2}. Print it exactly, with no rounding: as a plain integer when the area is whole, otherwise followed by a single decimal digit .5.5 (for example, 1.51.5).

Constraints

  • 3≤N≤50003 \le N \le 5000
  • 0≤xi,yi,L≤10000000 \le x_i, y_i, L \le 1000000
  • xi<xi+1x_i < x_{i+1} for every ii

Examples2

  1. Example 1

    Input
    5 4 
    0 0 1 3 2 0 3 3 4 0
    
    Expected output
    6
    
  2. Example 2

    Input
    3 10
    100 100 101 0 102 100
    
    Expected output
    0