Opinion Pool
Time limit1sMemory limit1024 MB
Given sets of voters and a fraction p, find the largest p for which some assignment with at least one opponent still satisfies every set's support quota.
- Level
Hard8 of 10
- Topics
- Binary search, Greedy, Math, Implementation
- Solved
- No attempts yet
Problem
MOLOCO, a company with a global reach, is developing a new survey platform to increase user engagement.
There are people who want to vote on an issue. Each person is either in support of the issue or against it.
There are sets of people , not necessarily disjoint. For these sets and a constant (), the following proposition holds.
- For every set , at least people belonging to are in support of the issue.
If , this proposition yields no information. means everyone is in support of the issue. That is, as grows, it becomes easier to determine who is in support of the issue.
Thus, if the proposition holds for a sufficiently large , we can know that everyone is in support of the issue. Find the maximum value of such that you cannot be certain everyone is in support of the issue.
Input
The first line contains two integers and , where is the number of people and is the number of sets.
The next lines describe each set.
The -th line starts with an integer , the number of elements in the set , followed by distinct integers , the elements of .
Output
Output the maximum value of such that you cannot be certain everyone is in support of the issue.
Your answer is considered correct if it has an absolute or relative error less than .
Constraints
- Everyone appears in at least one set.
Hint
In example 2, the proposition can hold for if people 1 and 3 are in support and people 2 and 4 are against.
However, if the proposition holds for , it contradicts the proposition if there is a person against the issue.