图论
Apollo_Dou
这个作者很懒,什么都没留下…
展开
-
A strange lift
A strange liftThere is a strange lift.The lift can stop can at every floor as you want, and there is a number Ki(0 <= Ki <= N) on every floor.The lift have just two buttons: up and down.When you at fl原创 2017-03-05 00:23:50 · 440 阅读 · 0 评论 -
In Action
In Action Since 1945, when the first nuclear bomb was exploded by the Manhattan Project team in the US, the number of nuclear weapons have soared across the globe. Nowadays,the crazy boy in FZU name原创 2017-03-05 00:34:46 · 358 阅读 · 0 评论 -
Arbitrage
ArbitrageArbitrage is the use of discrepancies in currency exchange rates to transform one unit of a currency into more than one unit of the same currency. For example, suppose that 1 US Dollar buys 0原创 2017-03-05 00:39:10 · 248 阅读 · 0 评论 -
Wormholes
Wormholes While exploring his many farms, Farmer John has discovered a number of amazing wormholes. A wormhole is very peculiar because it is a one-way path that delivers you to its destination at a t原创 2017-03-05 00:46:11 · 252 阅读 · 0 评论 -
tree
A - tree 给你一个无向带权连通图,每条边是黑色或白色。让你求一棵最小权的恰好有need条白色边的生成树。 题目保证有解。Input 第一行V,E,need分别表示点数,边数和需要的白色边数。 接下来E行,每行s,t,c,col表示这边的端点(点从0开始标号),边权,颜色(0白色1黑色)。Output 一行表示所求生成树的边权和。 V<=50000,E<=100000,所有数据边权原创 2017-03-12 23:06:17 · 396 阅读 · 0 评论 -
ACM Contest and Blackout
ACM Contest and Blackout In order to prepare the “The First National ACM School Contest” (in 20??) the major of the city decided to provide all the schools with a reliable source of power. (The major原创 2017-03-12 23:15:45 · 460 阅读 · 0 评论 -
Connect the Campus
Connect the Campus 题目大意:给定n个点的坐标,其中m个点已经连接,问把所有点都连接的最小花费?思路:并查集–Dijkstra,已经连接的就初始化为一个连通块里,然后再跑一边最小生成树就可以了。code:#include<iostream>#include<cstdio>#include<cstring>#include<algorithm>#include<cma原创 2017-03-12 23:23:39 · 362 阅读 · 0 评论 -
Slim Span
Slim Span 题目大意:给定N个点,M条边,问它的生成树中权值最大的边和权值最小的边的差值最小是多少?思路:Dijkstra.将M条边排序,然后求最小生成树,然后把(1)这条边去掉,再做最小生成树,然后把(2)这条边去掉……这样比较每次求出的差值取最小值就可以(注意边的数量不能少于n-1)。这里要注意:去掉若干条边之后,可能就没有生成树了,这里一定要注意判断!code:#incl原创 2017-03-12 23:32:35 · 520 阅读 · 0 评论 -
Boredom
Boredom Alex doesn’t like boredom. That’s why whenever he gets bored, he comes up with games. One long winter evening he came up with a game and decided to play it.Given a sequence a consisting of n i原创 2017-03-12 23:41:37 · 651 阅读 · 0 评论