Team Difficulty

Time limit1sMemory limit128 MB

Summary
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 nn and the number of pairs mm that collaborate poorly when on the same team. (1≤n≤1001 \le n \le 100, 0≤m≤10000 \le m \le 1000)

Each of the next mm lines contains two people aia_i and bib_i forming such a pair. (1≤ai,bi≤n1 \le a_i, b_i \le n, ai≠bia_i \ne b_i) 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 pp is the number of poorly-collaborating pairs inside that team, qq is the number of members, and gcd⁡(p,q)=1\gcd(p, q) = 1.

If no team contains any poorly-collaborating pair (the maximum difficulty is 0), print 0/1.

Examples3

  1. Example 1

    Input
    5 6
    1 5
    5 4
    4 2
    2 5
    1 2
    3 1
    
    Expected output
    5/4
    
  2. Example 2

    Input
    1 0
    
    Expected output
    0/1
    
  3. Example 3

    Input
    2 1
    1 2
    
    Expected output
    1/2