AlgoLensArena
ContestlərProblemlərOtaqlar
Vizualizator
← Məsələlər

FPC25-030.Kite Construction

Easy · 4 s · 256 MB

  • icpc
  • fpc
  • 2025

Summer is coming up, and you and your friends love to fly kites at the beach. You plan to make nnn new kites this year, and paint them in some range of colours. For this, you already have a practically unlimited amount of canvas and paint, but the limiting factor is where you can put the painted kites while they dry.

To hang out the kites for drying, you found a square field with side length ℓ\ellℓ. On each of the four sides of the field, there are nnn poles. The corners of the field are at coordinates (0,0)(0, 0)(0,0), (ℓ,0)(\ell, 0)(ℓ,0), (0,ℓ)(0, \ell)(0,ℓ), and (ℓ,ℓ)(\ell, \ell)(ℓ,ℓ), and you know the coordinates of the poles in this coordinate system. There are no poles exactly on a corner of the square, and no poles inside the square.

Since you are planning to make as many kites as there are poles on each side of the field, and each kite has four corners, you want to attach each of the corners of each kite to a pole from each of the four sides. Additionally, each pole should be attached to exactly one corner of a kite. Of course, larger kites are more fun, so you want to maximize the total area of the kites.

Although you vaguely remember from geometry class that a kite has some special properties, you decide to use your artistic freedom and just allow any (convex) quadrilateral as the shape of your kites.

Giriş formatı

The input consists of:

• One line with two integers nnn and ℓ\ellℓ (1≤n≤1051\leq n\leq 10^51≤n≤105, 1≤ℓ≤1061 \leq \ell \leq 10^61≤ℓ≤106), the number of kites you want to make and the side length of the square field.

• 4n4n4n lines, each with two integers xxx and yyy (0≤x,y≤ℓ0 \leq x, y \leq \ell0≤x,y≤ℓ), the coordinates of the poles on the sides of the square.

It is guaranteed that all poles lie on the boundary of the square and nnn poles lie on each side of the square, and no poles lie on a corner of the square. It is also guaranteed that no two poles are at the same location.

Çıxış formatı

Output the maximum total area of the nnn kites.

Your answer should have an absolute or relative error of at most 10−910^{-9}10−9.

Qeyd

Source: Freshmen Programming Contest 2025 · License: CC BY-SA 4.0 · Original: https://fpc.wisv.ch · Statement adapted for AlgoLens and shared under the same license. · 4 of the 31 original test cases (the largest) are omitted here to keep the problem lightweight.

Nümunələr

Giriş #1

1 4
2 4
0 2
2 0
4 2

Çıxış #1

8

Giriş #2

2 6
0 3
0 1
6 2
4 0
3 6
6 4
1 6
5 0

Çıxış #2

41.5