
图论
so_so_y
start to record bugs <- so hard so brave
展开
-
两次入坑逆向拓扑序(POJ 3687 Labeling Balls and HDU 4857 逃生)
第一次跳坑POJ 3687 Labeling BallsDescriptionWindy has N balls of distinct weights from 1 unit to N units. Now he tries to label them with 1 to N in such a way that:No two balls share the same label. The l原创 2017-03-14 13:34:51 · 404 阅读 · 0 评论 -
Codeforces Round #460(Div. 2) D. Substring(记忆化搜索+判环)
DescriptionYou are given a graph with n nodes and m directed edges. One lowercase letter is assigned to each node. We define a path’s value as the number of the most frequently occurring letter. For...原创 2018-02-15 15:25:57 · 276 阅读 · 0 评论 -
hdu 2063 过山车(二分图最大匹配)
Problem DescriptionRPG girls今天和大家一起去游乐场玩,终于可以坐上梦寐以求的过山车了。可是,过山车的每一排只有两个座位,而且还有条不成文的规矩,就是每个女生必须找个个男生做partner和她同坐。但是,每个女孩都有各自的想法,举个例子把,Rabbit只愿意和XHD或PQK做partner,Grass只愿意和linle或LL做partner,PrincessSnow愿...原创 2018-02-16 15:13:22 · 205 阅读 · 0 评论 -
牛客网 石油采集(二分图最大匹配,dfs)
链接:https://www.nowcoder.com/acm/contest/76/A 来源:牛客网题目描述 随着海上运输石油泄漏的问题,一个新的有利可图的行业正在诞生,那就是撇油行业。如今,在墨西哥湾漂浮的大量石油,吸引了许多商人的目光。这些商人们有一种特殊的飞机,可以一瓢略过整个海面20米乘10米这么大的长方形。(上下相邻或者左右相邻的格子,不能斜着来)当然,这要求一瓢撇过去的...原创 2018-02-16 15:39:14 · 458 阅读 · 0 评论 -
hdu 1507 Uncle Tom's Inherited Land(二分图最大匹配)
Problem DescriptionYour old uncle Tom inherited a piece of land from his great-great-uncle. Originally, the property had been in the shape of a rectangle. A long time ago, however, his great-great-u...原创 2018-02-16 15:21:57 · 366 阅读 · 0 评论 -
codeforces 618 D. Hamiltonian Spanning Tree(dfs)
DescriptionA group of n cities is connected by a network of roads. There is an undirected road between every pair of cities, so there are roads in total. It takes exactly y seconds to traverse any s...原创 2018-02-26 00:53:14 · 317 阅读 · 0 评论 -
CodeForces 716D Complete The Graph(spfa)+spfa标记最短路径 + 负环判断
DescriptionZS the Coder has drawn an undirected graph of n vertices numbered from 0 to n - 1 and m edges between them. Each edge of the graph is weighted, each weight is a positive integer.The nex...原创 2018-03-21 18:43:03 · 254 阅读 · 0 评论 -
Codeforces 954D Fight Against Traffic(最短路)
DescriptionLittle town Nsk consists of n junctions connected by m bidirectional roads. Each road connects two distinct junctions and no two roads connect the same pair of junctions. It is possible t...原创 2018-03-26 19:31:30 · 405 阅读 · 0 评论 -
51nod 1459 迷宫游戏(spfa)
Description你来到一个迷宫前。该迷宫由若干个房间组成,每个房间都有一个得分,第一次进入这个房间,你就可以得到这个分数。还有若干双向道路连结这些房间,你沿着这些道路从一个房间走到另外一个房间需要一些时间。游戏规定了你的起点和终点房间,你首要目标是从起点尽快到达终点,在满足首要目标的前提下,使得你的得分总和尽可能大。现在问题来了,给定房间、道路、分数、起点和终点等全部信息,你能计算在尽快...原创 2018-04-11 21:31:58 · 221 阅读 · 0 评论 -
Wannafly挑战赛14 C 可达性(Tarjan缩点)
链接:https://www.nowcoder.com/acm/contest/81/C 来源:牛客网题目描述 给出一个 0 ≤ N ≤ 105 点数、0 ≤ M ≤ 105 边数的有向图, 输出一个尽可能小的点集,使得从这些点出发能够到达任意一点,如果有多个这样的集合,输出这些集合升序排序后字典序最小的。输入描述:第一行为两个整数 1 ≤ n, m ≤ 105, 接...原创 2018-04-22 11:03:17 · 270 阅读 · 0 评论 -
POJ 2553 The Bottom of a Graph(tarjan缩点)
DescriptionWe will use the following (standard) definitions from graph theory. Let V be a nonempty and finite set, its elements being called vertices (or nodes). Let E be a subset of the Cartesian p...原创 2018-04-13 13:16:08 · 168 阅读 · 0 评论 -
山东省第七届ACM省赛 Proxy(spfa输出路径)
Problem DescriptionBecause of the GFW (Great Firewall), we cannot directly visit many websites, such as Facebook, Twitter, YouTube, etc. But with the help of proxy and proxy server, we can easily ge...原创 2018-04-24 16:53:30 · 276 阅读 · 0 评论 -
Codeforces Detour(Dijkstra +爆搜)
DescriptionAfter last year’s edition of the BAPC, you are still stuck in Delft. In order to participate again this year, you are going to Amsterdam by bus. During the journey you look out of the win...原创 2018-05-02 21:26:16 · 488 阅读 · 0 评论 -
51nod 1445 变色DNA(最短路)
Description有一只特别的狼,它在每个夜晚会进行变色,研究发现它可以变成N种颜色之一,将这些颜色标号为0,1,2…N-1。研究发现这只狼的基因中存在一个变色矩阵,记为colormap,如果colormap[i][j]=’Y’则这只狼可以在某一个夜晚从颜色i变成颜色j(一晚不可以变色多次),如果colormap[i][j]=‘N’则不能在一个晚上从i变成j色。进一步研究发现,这只狼每次变色并不原创 2017-10-26 10:34:28 · 359 阅读 · 0 评论 -
51nod 1693 水群(spfa最短路)
Description总所周知,水群是一件很浪费时间的事,但是其实在水群这件事中,也可以找到一些有意思的东西。 比如现在,bx2k就在研究怎样水表情的问题。 首先,bx2k在对话框中输入了一个表情,接下来,他可以进行三种操作。 第一种,是全选复制,把所有表情全选然后复制到剪贴板中。 第二种,是粘贴,把剪贴板中的表情粘贴到对话框中。 第三种,是退格,把对话框中的最后一个表情删去。 假设当前原创 2017-10-25 22:25:09 · 366 阅读 · 0 评论 -
POJ 2485 Highways (水题入门最小生成树)
DescriptionThe island nation of Flatopia is perfectly flat. Unfortunately, Flatopia has no public highways. So the traffic is difficult in Flatopia. The Flatopian government is aware of this problem. T原创 2017-03-08 13:42:31 · 618 阅读 · 0 评论 -
POJ 2240 Arbitrage(最短路)
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 currency. For example, suppose that 1 US Dollar buys原创 2017-03-01 19:56:17 · 380 阅读 · 0 评论 -
POJ 1125 Stockbroker Grapevine(最短路)
DescriptionStockbrokers are known to overreact to rumours. You have been contracted to develop a method of spreading disinformation amongst the stockbrokers to give your employer the tactical edge in t原创 2017-03-01 19:35:49 · 439 阅读 · 0 评论 -
POJ 1860 Currency Exchange(最短路)
DescriptionSeveral currency exchange points are working in our city. Let us suppose that each point specializes in two particular currencies and performs exchange operations only with these currencies.原创 2017-03-01 10:46:02 · 512 阅读 · 0 评论 -
POJ 1062 昂贵的聘礼(最短路)
Description年轻的探险家来到了一个印第安部落里。在那里他和酋长的女儿相爱了,于是便向酋长去求亲。酋长要他用10000个金币作为聘礼才答应把女儿嫁给他。探险家拿不出这么多金币,便请求酋长降低要求。酋长说:”嗯,如果你能够替我弄到大祭司的皮袄,我可以只要8000金币。如果你能够弄来他的水晶球,那么只要5000金币就行了。”探险家就跑到大祭司那里,向他要求皮袄或水晶球,大祭司要他用金币来换,或者原创 2017-03-01 12:09:54 · 586 阅读 · 0 评论 -
POJ 2253 Frogger(最短路)
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 visit her, but since the water is dirty and full of tou原创 2017-03-01 19:05:06 · 342 阅读 · 0 评论 -
POJ 1459 Power Network(网络流)
DescriptionA power network consists of nodes (power stations, consumers and dispatchers) connected by power transport lines. A node u may be supplied with an amount s(u) >= 0 of power, may produce an a原创 2017-08-16 21:34:06 · 236 阅读 · 0 评论 -
POJ 1679 The Unique MST(次小生成树之一)
DescriptionGiven a connected undirected graph, tell if its minimum spanning tree is unique. Definition 1 (Spanning Tree): Consider a connected, undirected graph G = (V, E). A spanning tree of G is a su原创 2017-08-19 10:41:01 · 282 阅读 · 0 评论 -
POJ 3259 Wormholes(最短路)
DescriptionWhile 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-01 11:24:51 · 480 阅读 · 0 评论 -
POJ 1789 Truck History(最小生成树)
DescriptionAdvanced Cargo Movement, Ltd. uses trucks of different types. Some trucks are used for vegetable delivery, other for furniture, or for bricks. The company has its own code describing each ty原创 2017-03-08 11:01:23 · 316 阅读 · 0 评论 -
POJ 3026 Borg Maze(最小生成树)
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 describe the group consciousness of the Borg civil原创 2017-03-08 11:17:36 · 363 阅读 · 0 评论 -
51nod 1444 破坏道路 最短路
Description在某一个国家,那儿有n个城市,他们通过m条双向道路相连。城市从1到n编号。如果城市a和b通过一条道路直接相连,那么他们之间的距离就是一个小时。这个国家的道路网络可以允许你从任意一个城市到达另外的城市。 现在你要破坏尽可能多的道路,但是要保证从城市s1到t1不超过l1小时,并且从城市s2到t2不超过l2小时。 输出最多可以破坏的道路数目,如果没有解,请输出-1Input单组测原创 2017-10-23 22:14:49 · 289 阅读 · 0 评论 -
山东省第六届ACM省赛 Circle of Friends(tarjan缩点+dfs)
Problem DescriptionNowadays, “Circle of Friends” is a very popular social networking platform in WeChat. We can share our life to friends through it or get other’s situation.Similarly, in real lif...原创 2018-04-28 19:37:56 · 230 阅读 · 0 评论