![](https://img-blog.csdnimg.cn/20201014180756923.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
图论
文章平均质量分 81
nudt_oys
An AC a day,keeps WA away~
展开
-
CCF CSP 2016年9月第4题 交通规划(Dijkstra算法)
问题描述试题编号:201609-4试题名称:交通规划时间限制:1.0s内存限制:256.0MB问题描述:问题描述 G国国王来中国参观后,被中国的高速铁路深深的震撼,决定为自己的国家也建设一个高速铁路系统。 建设高速铁路投入非常大,为了节约建设成本,G国国王决定原创 2017-10-12 19:48:42 · 1125 阅读 · 0 评论 -
POJ 1273 Drainage Ditches(最大流)
Drainage DitchesDescriptionEvery time it rains on Farmer John's fields, a pond forms over Bessie's favorite clover patch. This means that the clover is covered by water for awhile and take原创 2016-11-11 23:16:44 · 364 阅读 · 0 评论 -
HDOJ 1162 Eddy's picture(最小生成树)
Eddy's pictureProblem DescriptionEddy begins to like painting pictures recently ,he is sure of himself to become a painter.Every day Eddy draws pictures in his small room, and he usually原创 2016-10-17 22:36:29 · 457 阅读 · 0 评论 -
HDOJ 2377 Bus Pass(建图 + BFS)
Bus PassProblem DescriptionYou travel a lot by bus and the costs of all the seperate tickets are starting to add up. Therefore you want to see if it might be advantageous for you to bu原创 2016-10-27 23:12:54 · 344 阅读 · 0 评论 -
POJ 2240 Arbitrage(最短路)
ArbitrageDescriptionArbitrage 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原创 2016-10-23 23:03:03 · 292 阅读 · 0 评论 -
POJ 3660 Cow Contest(Floyd求传递闭包)
Cow ContestDescriptionN (1 ≤ N ≤ 100) cows, conveniently numbered 1..N, are participating in a programming contest. As we all know, some cows code better than others. Each cow has a certai原创 2016-10-21 19:35:53 · 354 阅读 · 0 评论 -
HDOJ 3790 最短路径问题(双权值最短路)
最短路径问题Problem Description给你n个点,m条无向边,每条边都有长度d和花费p,给你起点s终点t,要求输出起点到终点的最短距离及其花费,如果最短距离有多条路线,则输出花费最少的。 Input输入n,m,点的编号是1~n,然后是m行,每行4个数 a,b,d,p,表示a和b之间有一条边,且其长度为d,花费为p。最后一行是两个数原创 2016-08-27 10:09:29 · 724 阅读 · 0 评论 -
POJ 1511 Invitation Cards(双向最短路)
Invitation CardsDescriptionIn the age of television, not many people attend theater performances. Antique Comedians of Malidinesia are aware of this fact. They want to propagate theater an原创 2016-08-27 09:54:56 · 567 阅读 · 0 评论 -
POJ 3522 Slim Span(最小差值生成树)
Slim SpanDescriptionGiven an undirected weighted graph G, you should find one of spanning trees specified as follows.The graph G is an ordered pair (V, E), where V is a set of vertices {原创 2016-08-26 21:14:26 · 1712 阅读 · 0 评论 -
HDOJ 3549 Flow Problem(最大流)
Flow ProblemDescriptionNetwork flow is a well-known difficult problem for ACMers. Given a graph, your task is to find out the maximum flow for the weighted directed graph.I原创 2016-11-12 12:39:25 · 393 阅读 · 0 评论 -
CSUOJ 1808 地铁(最短路)
1808: 地铁DescriptionBobo居住在大城市ICPCCamp。ICPCCamp 有 n 个地铁站,用 1,2,…,n 编号。 m 段双向的地铁线路连接 n 个地铁站,其中第 i 段地铁属于 ci 号线,位于站 ai,bi 之间,往返均需要花费 ti 分钟(即从 ai 到 bi 需要 ti 分钟,从 bi 到 ai 也需要 ti 分钟)。众所原创 2016-09-04 15:25:32 · 1485 阅读 · 0 评论 -
CCF CSP 2014年12月第4题 最优灌溉(并查集+Kruskal算法)
问题描述试题编号:201412-4试题名称:最优灌溉时间限制:1.0s内存限制:256.0MB问题描述:问题描述 雷雷承包了很多片麦田,为了灌溉这些麦田,雷雷在第一个麦田挖了一口很深的水井,所有的麦田都从这口井来引水灌溉。 为了灌溉,雷雷需要建立一些水渠,以连原创 2017-10-02 21:55:49 · 1564 阅读 · 0 评论 -
CCF CSP 2017年3月第4题 地铁修建(Kruskal算法)
问题描述试题编号:201703-4试题名称:地铁修建时间限制:1.0s内存限制:256.0MB问题描述:问题描述 A市有n个交通枢纽,其中1号和n号非常重要,为了加强运输能力,A市决定在1号到n号枢纽间修建一条地铁。 地铁由很多段隧道组成,每段隧道连接两个交通原创 2017-09-30 22:12:42 · 1721 阅读 · 0 评论 -
CCF CSP 2015年9月第4题 高速公路(求连通分量)
问题描述试题编号:201509-4试题名称:高速公路时间限制:1.0s内存限制:256.0MB问题描述:问题描述 某国有n个城市,为了使得城市间的交通更便利,该国国王打算在城市之间修一些高速公路,由于经费限制,国王打算第一阶段先在部分城市之间修一些单向的高速公路。原创 2017-10-07 19:39:32 · 710 阅读 · 0 评论 -
CCF CSP 2015年03月第4题 网络延迟(求树的直径)
问题描述试题编号:201503-4试题名称:网络延时时间限制:1.0s内存限制:256.0MB问题描述:问题描述 给定一个公司的网络,由n台交换机和m台终端电脑组成,交换机与交换机、交换机与电脑之间使用网络连接。交换机按层级设置,编号为1的交换机为根交换机,层级为1原创 2017-10-07 10:44:45 · 763 阅读 · 0 评论 -
CSUOJ 1885 条条大路通罗马(最长路径)
Description罗马很远。从探险家马可所在的城市出发,还要经过很多城市、经过很久才能到达罗马。探险家马可出发了。虽然他没有地图、不知道路,但是他知道,他正在走的路是罗马人建造的,罗马的建筑师为了方便人们前往罗马,使得你从任何一个城市出发,都不会再回到这座城市。其实马可并没有错,条条大道通罗马,只要一直向前,他总会到的。但是,如果选错了道路,那么他将要花费非常多的时间。现在原创 2017-04-23 21:39:33 · 1325 阅读 · 0 评论 -
CSUOJ 1219 建食堂(两点之间最大距离最小)
1219: 建食堂给出n个公寓的互相距离,选择在其中一个公寓楼下建食堂,要求食堂到最远的公寓的距离最短。Input每组数据第一行为两个正整数n,m。n表示公寓数,m表示可彼此直达的公寓对。接下来m行每行给出两个彼此可直达的公寓i、j和它们之间的距离k。2 Output输出一行一个整数表示建好原创 2016-12-25 18:49:58 · 583 阅读 · 0 评论 -
CSUOJ 1256 天朝的单行道(最短路)
1256: 天朝的单行道Description 在另一个平行宇宙中,有一个神奇的国度名叫天朝。天朝一共有N个城市(标号分别为1, 2, …, N),M条道路,为了方便交通管制,天朝的M条道路都是单行道。 不久前天朝大选,小Q当选了天朝的总统。小Q家住在城市1,但天朝的办公地点在城市N,于是为了便于工作,小Q决定举家从城市1搬迁到城市N去居住。然而小Q惊奇的发原创 2016-08-17 17:04:54 · 313 阅读 · 0 评论 -
UVaOJ 10048 Audiophobia(最小化最短路的最大权值边)
AudiophobiaConsider yourself lucky! Consider yourself lucky to be still breathing and having fun participating inthis contest. But we apprehend that many of your descendants may not have this luxury原创 2016-09-06 15:41:12 · 725 阅读 · 0 评论 -
UVaOJ 247 Calling Circles(传递闭包)
Calling CirclesIf you’ve seen television commercials for long-distance phone companies lately, you’ve noticed thatmany companies have been spending a lot of money trying to convince people that they原创 2016-09-05 22:36:54 · 401 阅读 · 0 评论 -
POJ 3273 Conscription(最小生成树)
ConscriptionDescriptionWindy 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 soldiers. To colle原创 2016-08-25 21:56:49 · 368 阅读 · 0 评论 -
HDOJ 2066 一个人的旅行(最短路)
一个人的旅行Problem Description虽然草儿是个路痴(就是在杭电待了一年多,居然还会在校园里迷路的人,汗~),但是草儿仍然很喜欢旅行,因为在旅途中 会遇见很多人(白马王子,^0^),很多事,还能丰富自己的阅历,还可以看美丽的风景……草儿想去很多地方,她想要去东京铁塔看夜景,去威尼斯看电影,去阳明山上看海芋,去纽约纯粹看雪景,去巴黎喝咖啡写信,去北京探望孟姜原创 2016-08-20 20:15:34 · 305 阅读 · 0 评论 -
POJ 3255 Roadblocks(次短路)
RoadblocksDescriptionBessie has moved to a small farm and sometimes enjoys returning to visit one of her best friends. She does not want to get to her old home too quickly, because she lik原创 2016-08-20 16:00:10 · 274 阅读 · 0 评论 -
HDOJ 5253 连接的管道(最小生成树)
连接的管道Problem Description老 Jack 有一片农田,以往几年都是靠天吃饭的。但是今年老天格外的不开眼,大旱。所以老 Jack 决定用管道将他的所有相邻的农田全部都串联起来,这样他就可以从远处引水过来进行灌溉了。当老 Jack 买完所有铺设在每块农田内部的管道的时候,老 Jack 遇到了新的难题,因为每一块农田的地势高度都不同,所以要想将两块农田的管原创 2016-08-30 22:04:18 · 366 阅读 · 0 评论 -
UVaOJ 10305 Ordering Tasks(拓扑排序)
Ordering TasksJohn has n tasks to do. Unfortunately, the tasks are not independent and the execution of one task isonly possible if other tasks have already been executed.InputThe input will con原创 2016-09-11 09:06:19 · 401 阅读 · 0 评论 -
POJ 2349 Arctic Network(最小生成树)
Arctic NetworkDescriptionThe Department of National Defence (DND) wishes to connect several northern outposts by a wireless network. Two different communication technologies are to be used原创 2016-08-18 22:57:51 · 368 阅读 · 0 评论 -
HDOJ 1875 畅通工程再续(最小生成树)
畅通工程再续Problem Description相信大家都听说一个“百岛湖”的地方吧,百岛湖的居民生活在不同的小岛中,当他们想去其他的小岛时都要通过划小船来实现。现在政府决定大力发展百岛湖,发展首先要解决的问题当然是交通问题,政府决定实现百岛湖的全畅通!经过考察小组RPRush对百岛湖的情况充分了解后,决定在符合条件的小岛间建上桥,所谓符合条件,就是2个小岛之间的距离原创 2016-08-18 22:42:47 · 349 阅读 · 0 评论 -
POJ 1724 ROADS(BFS + 优先队列)
ROADSDescriptionN cities named with numbers 1 ... N are connected with one-way roads. Each road has two parameters associated with it : the road length and the toll that needs to be paid f原创 2016-08-17 23:46:33 · 418 阅读 · 0 评论 -
POJ 2485 Highways(最小生成树)
HighwaysDescriptionThe island nation of Flatopia is perfectly flat. Unfortunately, Flatopia has no public highways. So the traffic is difficult in Flatopia. The Flatopian government is awa原创 2016-08-17 22:16:13 · 260 阅读 · 0 评论 -
CodeForces 707B Bakery(建图 + 枚举)
B. BakeryMasha wants to open her own bakery and bake muffins in one of the n cities numbered from 1 to n. There are m bidirectional roads, each of whose connects some pair of cities.原创 2016-08-21 09:12:23 · 502 阅读 · 0 评论 -
POJ 3259 Wormholes(判负圈)
WormholesDescriptionWhile 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原创 2016-08-22 16:57:40 · 282 阅读 · 0 评论 -
POJ 2784 Buy or Build(二进制枚举 + 最小生成树)
Buy or BuildDescriptionWorld Wide Networks (WWN) is a leading company that operates large telecommunication networks. WWN would like to setup a new network in Borduria, a nice country that原创 2016-09-03 21:55:04 · 511 阅读 · 0 评论 -
HDOJ 1102 Constructing Roads(最小生成树)
Constructing RoadsProblem DescriptionThere are N villages, which are numbered from 1 to N, and you should build some roads such that every two villages can connect to each other. We say原创 2016-08-24 18:04:35 · 314 阅读 · 0 评论 -
POJ 3268 Silver Cow Party(双向最短路)
Silver Cow PartyDescriptionOne cow from each of N farms (1 ≤ N ≤ 1000) conveniently numbered 1..N is going to attend the big cow party to be held at farm #X (1 ≤ X ≤ N). A total of M (1 ≤原创 2016-08-26 13:49:18 · 529 阅读 · 0 评论 -
POJ 2139 Six Degrees of Cowvin Bacon(最短路)
Six Degrees of Cowvin BaconDescriptionThe cows have been making movies lately, so they are ready to play a variant of the famous game "Six Degrees of Kevin Bacon". The game works like原创 2016-09-02 21:42:49 · 383 阅读 · 0 评论 -
POJ 1258 Agri-Net(最小生成树)
Agri-NetDescriptionFarmer 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 your help, of course.原创 2016-08-23 22:45:17 · 340 阅读 · 0 评论 -
AOJ 2224 Save your cats(最小生成树)
Save your catsNicholas 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 also loved them.One day, an原创 2016-09-02 15:04:33 · 545 阅读 · 0 评论 -
AOJ 0189 Convenient Location(最短路)
Convenient Location来春卒業するAさんは,就職を機に引越しをすることにしました。就職する会社は,オフィスがい くつかの町にあって、日によって出勤するオフィスが違います。そこでAさんは,どこのオフィスに 行くにも時間の短い町に住もうと考えました。そこであなたは、Aさんを助けるため、住むのに一番便利な町を探すことになりました。町には0から始まる番号原创 2016-09-02 08:49:21 · 369 阅读 · 0 评论 -
AOJ 2249 Road Construction(双权值最短路)
Road ConstructionKing Mercer is the king of ACM kingdom. There are one capital and some cities in his kingdom. Amazingly, there are no roads in the kingdom now. Recently, he planned to construct原创 2016-09-02 08:06:43 · 814 阅读 · 0 评论 -
HDOJ 1874 畅通工程续(最短路)
畅通工程续Problem Description某省自从实行了很多年的畅通工程计划后,终于修建了很多路。不过路多了也不好,每次要从一个城镇到另一个城镇时,都有许多种道路方案可以选择,而某些方案要比另一些方案行走的距离要短很多。这让行人很困扰。现在,已知起点和终点,请你计算出要从起点到终点,最短需要行走多少距离。 Input本题目包含多原创 2016-08-16 22:59:44 · 301 阅读 · 0 评论