QOJ.ac

QOJ

حد الوقت: 1 s حد الذاكرة: 1024 MB مجموع النقاط: 100

#18425. 意见池

الإحصائيات

MOLOCO 是一家拥有无可比拟的全球影响力的跨国公司,他们正在开发一个新的调查平台,以提高用户参与度。

有 $N$ 个人想要对一个议题进行投票。每个人要么支持该议题,要么反对该议题。

现有 $M$ 个不一定两两不相交的人的集合 $S_1, S_2, \dots, S_M$。对于这 $M$ 个集合和一个常数 $p$ ($0 \le p \le 1$),以下命题成立:

  • 对于每个集合 $S_i$,属于 $S_i$ 的人中至少有 $p \cdot |S_i|$ 个人支持该议题。

如果 $p = 0$,则无法从该命题中获得任何信息。$p = 1$ 表明每个人都支持该议题。也就是说,随着 $p$ 的增加,越容易确定谁支持该议题。

因此,如果该命题对于足够大的 $p$ 成立,我们就可以知道每个人都支持该议题。求 $p$ 的最大值,使得你无法确定每个人都支持该议题。

输入格式

第一行包含两个整数 $N$ 和 $M$,其中 $N$ 表示人数,$M$ 表示集合的数量。

接下来的 $M$ 行描述了这 $M$ 个集合的信息。

第 $i$ 行以一个整数 $|S_i|$ 开始,表示集合 $S_i$ 中的元素个数,随后是 $|S_i|$ 个互不相同的整数 $S_{i,j}$,表示集合 $S_i$ 中的元素。

输出格式

输出 $p$ 的最大值,使得你无法确定每个人都支持该议题。

如果你的答案与标准答案的绝对误差或相对误差小于 $10^{-6}$,则视为正确。

数据范围

  • $1 \le N, M \le 200\,000$
  • $S_i \subseteq \{1, 2, \dots, N\}$ ($1 \le i \le M$)
  • $\sum_{i=1}^M |S_i| \le 1\,000\,000$
  • 每个人至少出现在一个集合中。

子任务

子任务 1 (10 分)

该子任务满足以下附加限制:

  • $N \le 10$
  • $M \le 500$

子任务 2 (15 分)

该子任务满足以下附加限制:

  • $N, M \le 500$

子任务 3 (75 分)

该子任务没有附加限制。

样例

输入样例 1

3 3
1 1
1 2
1 3

输出样例 1

0

输入样例 2

4 2
2 1 2
2 3 4

输出样例 2

0.5

输入样例 3

10 7
4 8 6 10 5
4 9 5 6 1
4 4 8 1 10
4 1 5 9 3
4 6 10 5 1
4 8 3 1 10
6 5 7 6 8 1 2

输出样例 3

0.833333333

说明

在样例 2 中,如果第 1、3 个人支持,第 2、4 个人反对,则该命题在 $p = 0.5$ 时可以成立。

然而,如果该命题对于 $p > 0.5$ 成立,那么只要存在任何一个反对该议题的人,都会与该命题产生矛盾。

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.