Good Bye 2013
E
New Year Tree Decorations
Codeforces
2500
原题
← DF →
翻译中…

Due to atheistic Soviet past, Christmas wasn't officially celebrated in Russia for most of the twentieth century. As a result, the Russian traditions for Christmas and New Year mixed into one event celebrated on the New Year but including the tree, a Santa-like 'Grandfather Frost', presents and huge family reunions and dinner parties all over the country. Bying a Tree at the New Year and installing it in the house is a tradition. Usually the whole family decorates the tree on the New Year Eve. We hope that Codeforces is a big and loving family, so in this problem we are going to decorate a tree as well.

翻译中…

So, our decoration consists of $*n*$ pieces, each piece is a piece of colored paper, its border is a closed polyline of a special shape. The pieces go one by one as is shown on the picture. The $*i*$-th piece is a polyline that goes through points: $(0, 0)$, $(0, *y*_{0})$, $(1, *y*_{1})$, $(2, *y*_{2})$, ..., $(*k*, *y*_{*k*})$, $(*k*, 0)$. The width of each piece equals $*k*$.

翻译中…

image The figure to the left shows the decoration, the figure to the right shows the individual pieces it consists of.

翻译中…

The piece number 1 (shown red on the figure) is the outer piece (we see it completely), piece number 2 (shown yellow) follows it (we don't see it completely as it is partially closed by the first piece) and so on. The programmers are quite curious guys, so the moment we hung a decoration on the New Year tree we started to wonder: what area of each piece can people see?

翻译中…

Input

翻译中…

The first line contains two integers, $*n*$ and $*k*$ $(1 ≤ *n*, *k* ≤ 300)$. Each of the following $*n*$ lines contains $*k* + 1$ integers — the description of the polyline. If the $*i*$-th line contains ontegers $*y*_{*i*, 0}, *y*_{*i*, 1}, ..., *y*_{*i*, *k*}$, that means that the polyline of the $*i*$-th piece goes through points $(0, 0)$, $(0, *y*_{*i*, 0})$, $(1, *y*_{*i*, 1})$, $(2, *y*_{*i*, 2})$, ..., $(*k*, *y*_{*i*, *k*})$, $(*k*, 0)$ $(1 ≤ *y*_{*i*, *j*} ≤ 1000)$.

翻译中…

Output

翻译中…

Print $*n*$ real numbers — for each polyline, the area of its visible part.

翻译中…

The answer will be considered correct if its relative or absolute error do not exceed $10^{ - 4}$.

翻译中…

样例

Input #1
2 2
2 1 2
1 2 1
Output #1
3.000000000000
0.500000000000
InputCopy OutputCopy
Input #2
1 1
1 1
Output #2
1.000000000000
InputCopy OutputCopy
Input #3
4 1
2 7
7 2
5 5
6 4
Output #3
4.500000000000
1.250000000000
0.050000000000
0.016666666667
InputCopy OutputCopy
题目信息
题号
379E
所属比赛
时间限制
1 s
内存限制
256 MB
标签
计算几何
调度
排序

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。