当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

6187:Destroy Walls

题目描述
Long times ago, there are beautiful historic walls in the city. These walls divide the city into many parts of area.

Since it was not convenient, the new king wants to destroy some of these walls, so he can arrive anywhere from his castle. We assume that his castle locates at $(0.6*\sqrt 2 , 0.6*\sqrt 3 )$.

There are $n$ towers in the city, which numbered from 1 to n. The ith's location is $(x_i,y_i)$. Also, there are m walls connecting the towers. Specifically, the ith wall connects the tower $u_i$ and the tower $v_i$(including the endpoint). The cost of destroying the ith wall is $w_i$.

Now the king asks you to help him to divide the city. Firstly, the king wants to destroy as less walls as possible, and in addition, he wants to make the cost least.

The walls only intersect at the endpoint. It is guaranteed that no walls connects the same tower and no 2 walls connects the same pair of towers. Thait is to say, the given graph formed by the walls and towers doesn't contain any multiple edges or self-loops.

Initially, you should tell the king how many walls he should destroy at least to achieve his goal, and the minimal cost under this condition.
输入解释
There are several test cases.

For each test case:

The first line contains 2 integer n, m.

Then next n lines describe the coordinates of the points.

Each line contains 2 integers $x_i,y_i$.

Then m lines follow, the ith line contains 3 integers $u_i,v_i,w_i$

$|x_i|,|y_i|\le 10^5$

$3\le n \le 100000,1\le m \le 200000$

$1\le u_i,v_i\le n ,u_i\ne v_i ,0\le w_i \le 10000$
输出解释
For each test case outout one line with 2 integers sperate by a space, indicate how many walls the king should destroy at least to achieve his goal, and the minimal cost under this condition.
输入样例
4 4
-1 -1
-1 1
1 1
1 -1
1 2 1
2 3 2
3 4 1
4 1 2
输出样例
1 1
来自杭电HDUOJ的附加信息
Recommend liuyiding

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-6187

最后修改于 2020-10-25T23:29:08+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
8000/4000MS(Java/Others) 132768/132768K(Java/Others)