logo AlgoBeat OnlineJudge
登录 注册

#217006. [NWERC 2019] Average Rank

内存限制:512 MiB 时间限制:5000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

:::align{center}

:::

The National Weekly Escape Room Challenge (NWERC) is a long-running competition held in Eindhoven. Every week a new escape room is presented, and anyone who completes it in their first attempt gains one point.

At the end of each week, competitors are ranked by the total number of points accumulated so far, highest first. In case of a tie, they share the same rank. In other words, the rank of a competitor is one more than the number of people with a strictly larger number of points.

In total there have been participants in the contest, and the contest has been going for weeks. For each week you are given a list of the competitors that gained a point that week. Your task is to calculate the average rank during the -week competition for each competitor.

Figure Figure illustrates the score progression in the third sample.

输入格式

The input consists of:

  • One line with two integers and (), the number of competitors and the number of weeks. The competitors are numbered from to .

  • lines (one for each week), each containing an integer () followed by distinct integers ( for all ), indicating that the competitors each gained a point that week.

The total number of points awarded is at most million.

输出格式

Output lines, the th of which contains the average rank of the th competitor during the -week competition. Your answers should have an absolute or relative error of at most .

样例

样例输入 1

3 2
2 1 2
2 1 3

样例输出 1

1.000000
1.500000
2.500000

样例输入 2

3 1
0

样例输出 2

1.000000
1.000000
1.000000

样例输入 3

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

样例输出 3

3.166666667
3.333333333
1.000000000
3.833333333
1.666666667