Drahc Designs the Map
该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。
Description
After graduation, Drahc joined YiHoMo and became a game designer. He has finished an outline of a map for his new game. There are several places on his map.
However, his boss, Teafrogsf, has proposed several suggestions that require Drahc to modify the map. After days and nights of revisions, Drahc fainted. But there still exists a last requirement for the map. You decide to assist him.
For convenience, we use a positive weighted undirected graph to represent the map. This requirement requires that for all spanning subgraphs of , there exists a unique spanning subgraph that has a minimum sum of weight. In other words, s.t. minimizes ().
Drahc's map is under protection, so you can only modify one edge at one time with its weight increased by . Drahc wants his map to be modified as little as possible. Therefore, you need to modify as few times as possible, and since the modification method may not be unique, you only need to output the minimum number of modifications.
Format
Input
The first line of input contains integers: . represents the number of vertices in and represents the number of edges in .
The next lines, each containing integers each: and . It means there exists an edge between and which is weighted .
Output
One integer: the minimum number of modifications.
Samples
6 8
1 2 1
1 3 1
2 3 1
4 5 1
4 6 1
5 6 2
1 4 2
3 5 2
2