Team Difficulty
Time limit1sMemory limit128 MB
Given a graph, find a subset of vertices maximizing the ratio of induced edges to vertices, output as a reduced fraction, which requires a max-density subgraph technique via binary search and max-flow.
- Level
Hard8 of 10
- Topics
- Graph, Binary search, Math
- Solved
- No attempts yet
Problem
Sangkeun is the CEO of a small company. The owner has appointed his son Jeongin as a team lead, and Sangkeun believes that if Jeongin performs well the owner will hand the CEO position to him. Luckily, Sangkeun gets to decide who joins Jeongin's team, so he wants to build the team on which Jeongin will find it hardest to perform.
Sangkeun knows every pair of people who collaborate poorly when placed on the same team. The difficulty of a team is defined as the number of poorly-collaborating pairs inside the team divided by the number of team members. The higher the difficulty, the harder the team is to manage.
Write a program that finds the maximum possible team difficulty. A team must contain at least one person, and a team of a single person has difficulty 0.
For example, if the hardest team turns out to be {1, 2, 4, 5}, it contains 5 poorly-collaborating pairs among 4 members, so its difficulty is 5/4. Adding person 3 would make it 6 pairs over 5 members, lowering the difficulty to 6/5.
Input
The first line contains the number of employees and the number of pairs that collaborate poorly when on the same team. (, )
Each of the next lines contains two people and forming such a pair. (, ) No pair is given twice.
Output
Print, on a single line, the maximum team difficulty over all possible teams as an irreducible fraction p/q, where is the number of poorly-collaborating pairs inside that team, is the number of members, and .
If no team contains any poorly-collaborating pair (the maximum difficulty is 0), print 0/1.