
并查集
HPU2_2
这个作者很懒,什么都没留下…
展开
-
畅通工程
畅通工程 Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 62867 Accepted Submission(s): 33637Problem Description 某省调查城镇交通状况,得到现有城镇道路统计表,表中列出...原创 2018-04-01 09:28:11 · 1714 阅读 · 0 评论 -
How Many Tables [并查集找父亲节点]
Today is Ignatius’ birthday. He invites a lot of friends. Now it’s dinner time. Ignatius wants to know how many tables he needs at least. You have to notice that not all the friends know each other, a...原创 2018-08-15 16:38:12 · 215 阅读 · 0 评论 -
Ubiquitous Religions [并查集找父亲节点]
There are so many different religions in the world today that it is difficult to keep track of them all. You are interested in finding out how many different religions students in your university beli...原创 2018-08-15 16:37:23 · 281 阅读 · 0 评论 -
The Suspects [并查集模板题]
Severe acute respiratory syndrome (SARS), an atypical pneumonia of unknown aetiology, was recognized as a global threat in mid-March 2003. To minimize transmission to others, the best strategy is to s...原创 2018-08-15 16:35:54 · 146 阅读 · 0 评论 -
Dragon Balls [并查集]
Five hundred years later, the number of dragon balls will increase unexpectedly, so it’s too difficult for Monkey King(WuKong) to gather all of the dragon balls together. His country has N cities an...原创 2018-08-15 16:33:30 · 153 阅读 · 0 评论 -
继续畅通工程
Problem Description 省政府“畅通工程”的目标是使全省任何两个村庄间都可以实现公路交通(但不一定有直接的公路相连,只要能间接通过公路可达即可)。现得到城镇道路统计表,表中列出了任意两城镇间修建道路的费用,以及该道路是否已经修通的状态。现请你编写程序,计算出全省畅通需要的最低成本。Input 测试输入包含若干测试用例。每个测试用例的第1行给出村庄数目N ( 1< N ...原创 2018-04-05 12:10:45 · 311 阅读 · 0 评论 -
畅通工程再续
Problem Description 相信大家都听说一个“百岛湖”的地方吧,百岛湖的居民生活在不同的小岛中,当他们想去其他的小岛时都要通过划小船来实现。现在政府决定大力发展百岛湖,发展首先要解决的问题当然是交通问题,政府决定实现百岛湖的全畅通!经过考察小组RPRush对百岛湖的情况充分了解后,决定在符合条件的小岛间建上桥,所谓符合条件,就是2个小岛之间的距离不能小于10米,也不能大于1000米...原创 2018-04-02 16:43:00 · 109 阅读 · 0 评论 -
畅通工程——2
Problem Description 省政府“畅通工程”的目标是使全省任何两个村庄间都可以实现公路交通(但不一定有直接的公路相连,只要能间接通过公路可达即可)。经过调查评估,得到的统计表中列出了有可能建设公路的若干条道路的成本。现请你编写程序,计算出全省畅通需要的最低成本。Input 测试输入包含若干测试用例。每个测试用例的第1行给出评估的道路条数 N、村庄数目M ( < 100 ...原创 2018-04-01 11:59:49 · 308 阅读 · 0 评论 -
还是畅通工程
Problem Description 某省调查乡村交通状况,得到的统计表中列出了任意两村庄间的距离。省政府“畅通工程”的目标是使全省任何两个村庄间都可以实现公路交通(但不一定有直接的公路相连,只要能间接通过公路可达即可),并要求铺设的公路总长度为最小。请计算最小的公路总长度。Input 测试输入包含若干测试用例。每个测试用例的第1行给出村庄数目N ( < 100 );随后的N(N-...原创 2018-04-01 11:03:56 · 287 阅读 · 0 评论 -
食物链 POJ - 1182
这个是挑战程序那本书上的代码,自己实现了一下。#include <iostream>#include <stdio.h>using namespace std;//const int MAX_N = 100000 + 7;int N, K;//int T[MAX_N], X[MAX_N], Y[MAX_N];int f[3 * 50000 + 7];...原创 2019-03-11 21:26:49 · 184 阅读 · 0 评论