QOJ.ac

QOJ

时间限制: 5 s 内存限制: 2048 MB 总分: 100

#2410. 平均排名

统计

“全国每周密室逃脱挑战赛”(NWERC)是在埃因霍温举办的一项长期竞赛。每周都会推出一个新的密室,任何在第一次尝试中完成它的人都会获得一分。

在每周结束时,参赛者会根据目前累计的总分进行排名,分数高者优先。如果分数相同,则他们共享同一个排名。换句话说,参赛者的排名等于分数严格高于他们的人数加一。

图 A.1:样例 3 的说明。

比赛总共有 $n$ 名参赛者,比赛已经进行了 $w$ 周。对于每一周,你都会得到一份该周获得积分的参赛者名单。你的任务是计算每位参赛者在 $w$ 周比赛期间的平均排名。

图 A.1 展示了第三个样例中的分数变化过程。

输入格式

输入包含: 一行包含两个整数 $n$ 和 $w$ ($1 \le n, w \le 3 \cdot 10^5$),分别表示参赛者人数和周数。参赛者编号为 $1$ 到 $n$。 $w$ 行(每周一行),每行包含一个整数 $k$ ($0 \le k \le n$),后跟 $k$ 个不同的整数 $c_1, \dots, c_k$ ($1 \le c_i \le n$,对于所有 $i$),表示这 $k$ 名参赛者 $c_1, \dots, c_k$ 在该周各获得了一分。

总共授予的积分数最多为 100 万。

输出格式

输出 $n$ 行,第 $i$ 行包含第 $i$ 位参赛者在 $w$ 周比赛期间的平均排名。你的答案应具有不超过 $10^{-6}$ 的绝对或相对误差。

样例

输入 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

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.