随笔分类 -  图论

摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1269Tarjan的强连通算法:对于每一个点有一个编号DFN和能往上一步的最小点的编号LOW在进行深搜时,对于每一个节点都有一个编号假定现在定点为u深搜时有两种情况1.v没有被搜过,继续搜,LOW[u] = min... 阅读全文
posted @ 2015-09-09 20:34 Painting、时光 阅读(403) 评论(0) 推荐(0)
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=5294SPFA:Bellman_Ford的队列优化算法无法处理带负环的图复杂度O(kE) k #include #include #include #include #include #include #inclu... 阅读全文
posted @ 2015-08-26 16:17 Painting、时光 阅读(209) 评论(0) 推荐(0)
摘要:Vasya has a very beautiful country garden that can be represented as ann × mrectangular field divided inton·msquares. One beautiful day Vasya remember... 阅读全文
posted @ 2015-07-20 14:33 Painting、时光 阅读(207) 评论(0) 推荐(0)
摘要:Problem Description传说在遥远的地方有一个非常富裕的村落,有一天,村长决定进行制度改革:重新分配房子。这可是一件大事,关系到人民的住房问题啊。村里共有n间房间,刚好有n家老百姓,考虑到每家都要有房住(如果有老百姓没房子住的话,容易引起不安定因素),每家必须分配到一间房子且只能得到一... 阅读全文
posted @ 2015-06-02 14:39 Painting、时光 阅读(144) 评论(0) 推荐(0)
摘要:Problem Description小明误入迷宫,塞翁失马焉知非福,原来在迷宫中还藏着一些财宝,小明想获得所有的财宝并离开迷宫。因为小明还是学生,还有家庭作业要做,所以他想尽快获得所有财宝并离开迷宫。Input有多组测试数据。每组数据第一行给出两个正整数n,m(0#include#include#... 阅读全文
posted @ 2015-04-28 19:40 Painting、时光 阅读(194) 评论(0) 推荐(0)
摘要:Description The contest is running and the judges is busy watching the progress of the contest. Suddenly, N - 1 (N #include#include#includeusing name... 阅读全文
posted @ 2015-04-27 21:55 Painting、时光 阅读(234) 评论(0) 推荐(0)
摘要:DescriptionThe Borg is an immensely powerful race of enhanced humanoids from the delta quadrant of the galaxy. The Borg collective is the term used to... 阅读全文
posted @ 2015-03-24 14:37 Painting、时光 阅读(123) 评论(0) 推荐(0)
摘要:Description有一天Stubird买了一台变形金刚,店员说,这台变形金刚和其他那种骗小孩子的不一样 他真的能变形。 这台变形金刚有n个部件,他们能互相连接,组成机器人,当然,也可以变形。 但是有一天,The tesseract 的能量突然消失了,部件散落一地,当然有些部件还连接着。 现在你只... 阅读全文
posted @ 2015-03-17 20:25 Painting、时光 阅读(165) 评论(0) 推荐(0)
摘要:Description上次Gardon的迷宫城堡小希玩了很久(见Problem B),现在她也想设计一个迷宫让Gardon来走。但是她设计迷宫的思路不一样,首先她认为所有的通道都应该是双向连通的,就是说如果有一个通道连通了房间A和B,那么既可以通过它从房间A走到房间B,也可以通过它从房间B走到房间A... 阅读全文
posted @ 2015-03-08 20:08 Painting、时光 阅读(234) 评论(0) 推荐(0)
摘要:相信大家都听说一个“百岛湖”的地方吧,百岛湖的居民生活在不同的小岛中,当他们想去其他的小岛时都要通过划小船来实现。现在政府决定大力发展百岛湖,发展首先要解决的问题当然是交通问题,政府决定实现百岛湖的全畅通!经过考察小组RPRush对百岛湖的情况充分了解后,决定在符合条件的小岛间建上桥,所谓符合条件,... 阅读全文
posted @ 2015-03-08 19:11 Painting、时光 阅读(245) 评论(0) 推荐(0)
摘要:Description省政府“畅通工程”的目标是使全省任何两个村庄间都可以实现公路交通(但不一定有直接的公路相连,只要能间接通过公路可达即可)。经过调查评估,得到的统计表中列出了有可能建设公路的若干条道路的成本。现请你编写程序,计算出全省畅通需要的最低成本。Input测试输入包含若干测试用例。每个测... 阅读全文
posted @ 2015-03-08 19:01 Painting、时光 阅读(276) 评论(0) 推荐(0)
摘要:Description某省调查乡村交通状况,得到的统计表中列出了任意两村庄间的距离。省政府“畅通工程”的目标是使全省任何两个村庄间都可以实现公路交通(但不一定有直接的公路相连,只要能间接通过公路可达即可),并要求铺设的公路总长度为最小。请计算最小的公路总长度。Input测试输入包含若干测试用例。每个... 阅读全文
posted @ 2015-03-08 18:52 Painting、时光 阅读(190) 评论(0) 推荐(0)
摘要:DescriptionFarmer John has been elected mayor of his town! One of his campaign promises was to bring internet connectivity to all farms in the area. H... 阅读全文
posted @ 2015-03-08 15:28 Painting、时光 阅读(142) 评论(0) 推荐(0)
摘要:DescriptionThe island nation of Flatopia is perfectly flat. Unfortunately, Flatopia has no public highways. So the traffic is difficult in Flatopia. T... 阅读全文
posted @ 2015-03-08 15:11 Painting、时光 阅读(152) 评论(0) 推荐(0)
摘要:DescriptionAdvanced Cargo Movement, Ltd. uses trucks of different types. Some trucks are used for vegetable delivery, other for furniture, or for bric... 阅读全文
posted @ 2015-03-08 14:31 Painting、时光 阅读(152) 评论(0) 推荐(0)
摘要:DescriptionStockbrokers are known to overreact to rumours. You have been contracted to develop a method of spreading disinformation amongst the stockb... 阅读全文
posted @ 2015-03-08 10:47 Painting、时光 阅读(472) 评论(0) 推荐(0)
摘要:DescriptionFreddy Frog is sitting on a stone in the middle of a lake. Suddenly he notices Fiona Frog who is sitting on another stone. He plans to visi... 阅读全文
posted @ 2015-03-07 14:17 Painting、时光 阅读(244) 评论(0) 推荐(0)
摘要:Description2008年将到,王飞同学化了九牛二虎之力搞到了2张2008年奥运会足球赛决赛的门票。真是开心啊!他爸爸准备开车跟他一起去北京看球赛。不过门票费好贵啊,所以他爸爸说了,这个钱要在下学期的生活费里扣(好抠门),不过如果他能让从杭州去北京的油费最省(油价最近涨的好厉害啊),那么就不扣... 阅读全文
posted @ 2015-03-07 13:06 Painting、时光 阅读(337) 评论(0) 推荐(0)
摘要:Description年轻的探险家来到了一个印第安部落里。在那里他和酋长的女儿相爱了,于是便向酋长去求亲。酋长要他用10000个金币作为聘礼才答应把女儿嫁给他。探险家拿不出这么多金币,便请求酋长降低要求。酋长说:"嗯,如果你能够替我弄到大祭司的皮袄,我可以只要8000金币。如果你能够弄来他的水晶球,... 阅读全文
posted @ 2015-03-06 20:44 Painting、时光 阅读(164) 评论(0) 推荐(0)
摘要:DescriptionArbitrage is the use of discrepancies in currency exchange rates to transform one unit of a currency into more than one unit of the same cu... 阅读全文
posted @ 2015-03-06 15:29 Painting、时光 阅读(150) 评论(0) 推荐(0)