QOJ.ac

QOJ

Límite de tiempo: 1 s Límite de memoria: 128 MB Puntuación total: 100

#15155. Busy City

Estadísticas

City C is a very busy metropolis, and the roads in the city are very congested, so the mayor has decided to renovate them. The roads in City C are distributed as follows: there are $n$ intersections in the city, and some intersections are connected by roads. There is at most one road between any two intersections. These roads are bidirectional and connect all intersections directly or indirectly. Each road has a score; the smaller the score, the busier the road and the more it needs to be renovated. However, the municipal government has limited funds, and the mayor hopes to renovate as few roads as possible. Therefore, he has proposed the following requirements:

  1. The renovated roads must be able to connect all intersections directly or indirectly.
  2. Subject to requirement 1, the number of renovated roads should be as small as possible.
  3. Subject to requirements 1 and 2, the maximum score among the renovated roads should be as small as possible.

Task: As a member of the city planning bureau, you should make the best decision and choose which roads should be renovated.

Input

The first line contains two integers $n$ and $m$, representing that the city has $n$ intersections and $m$ roads. The following $m$ lines describe each road, where $u, v, c$ indicate that there is a road between intersection $u$ and $v$ with a score of $c$. ($1 \le n \le 300$, $1 \le c \le 10000$)

Output

Two integers $s$ and $max$, representing the number of roads you have selected and the score of the road with the maximum score among them.

Examples

Input 1

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

Output 1

3 6

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.