随笔分类 -  树—最小生成树

摘要:题意:有n个点,q个套餐,求连接所有的点的最小花费。 题解:用二进制枚举每个套餐,然后跑Kruskal()。。。。。这种写法应该会超时的,可能数据太水了。。。。 阅读全文
posted @ 2017-08-12 20:23 天之道,利而不害 阅读(274) 评论(0) 推荐(0) 编辑
摘要:题意:寻找满足条件的最小生成树,条件是生成树中最长边与最短边的差越小越好。 题解:将边进行排序后,枚举第一条边,然后不断更新答案就行了。 阅读全文
posted @ 2017-08-12 20:16 天之道,利而不害 阅读(415) 评论(0) 推荐(0) 编辑
摘要:The cows have run out of hay, a horrible event that must be remedied immediately. Bessie intends to visit the other farms to survey their hay situatio 阅读全文
posted @ 2017-08-11 22:51 天之道,利而不害 阅读(188) 评论(0) 推荐(0) 编辑
摘要:Nicholas Y. Alford was a cat lover. He had a garden in a village and kept many cats in his garden. The cats were so cute that people in the village al 阅读全文
posted @ 2017-08-11 22:49 天之道,利而不害 阅读(254) 评论(0) 推荐(0) 编辑
摘要:Bessie has been hired to build a cheap internet network among Farmer John's N (2 <= N <= 1,000) barns that are conveniently numbered 1..N. FJ has alre 阅读全文
posted @ 2017-08-11 22:47 天之道,利而不害 阅读(159) 评论(0) 推荐(0) 编辑
摘要:Farmer John has been elected mayor of his town! One of his campaign promises was to bring internet connectivity to all farms in the area. He needs you 阅读全文
posted @ 2017-08-11 22:45 天之道,利而不害 阅读(193) 评论(0) 推荐(0) 编辑
摘要:Windy has a country, and he wants to build an army to protect his country. He has picked up N girls and M boys and wants to collect them to be his sol 阅读全文
posted @ 2017-08-11 22:43 天之道,利而不害 阅读(158) 评论(0) 推荐(0) 编辑
摘要:相信大家都听说一个“百岛湖”的地方吧,百岛湖的居民生活在不同的小岛中,当他们想去其他的小岛时都要通过划小船来实现。现在政府决定大力发展百岛湖,发展首先要解决的问题当然是交通问题,政府决定实现百岛湖的全畅通!经过考察小组RPRush对百岛湖的情况充分了解后,决定在符合条件的小岛间建上桥,所谓符合条件, 阅读全文
posted @ 2017-04-30 22:47 天之道,利而不害 阅读(247) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示