New Year Tree Decorations - CF Help!

pls someone give a detailed explanation of Problem 379E from codeforces. I am not able to get the explanation provided on codeforces.

thanks

I think the explanation is not so bad.
Ok. See what I understand…alt text

Explanation:
In this problem there will be some polyline(that forms a polygon in this problem), one placed upon another. First polygon will be the top. Then second polygon will be placed under first one. Then third polygon under the second and so on. You have to figure out what amount of area of each polygon one can 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 - each integer is the value for y-axis. If the i-th line contains integers y(i,0), y(i,1), …, y(i,k), that means that the polyline of the i-th polygon goes through points (0, 0), (0, y(i,0)), (1, y(i,1)), (2, y(i,2)), …, (k, y(i,k)), (k, 0) where (1 ≀ y(i,j) ≀ 1000). Each polyline must start from (0,0) and end at(k,0).
Here n is number of polyline (or polygon). For example, in the given picture there are 3 polygon colored as red, yellow and blue.

Output:
For each polygon print visible area in float and you have to solve this problem such a way that after decimal point minimum 4 digit must be correct(not truncated value).

I think this will help u. If not then know me where is the difficulty.

1 Like