图论
永恒—
反复与坚持之后,柔水终成雕刀
展开
-
Intervals ZOJ - 1508(差分约束系统)
题目 You are given n closed, integer intervals [ai, bi] and n integers c1, …, cn. Write a program that: reads the number of intervals, their endpoints and integers c1, …, cn from the standard input, com...原创 2020-02-02 18:16:02 · 229 阅读 · 0 评论 -
Burn the Linked Camp ZOJ - 2770(差分约束系统)
题目 It is well known that, in the period of The Three Empires, Liu Bei, the emperor of the Shu Empire, was defeated by Lu Xun, a general of the Wu Empire. The defeat was due to Liu Bei’s wrong decision...原创 2020-02-01 18:31:59 · 164 阅读 · 0 评论 -
The Doors POJ - 1556(路径选择门边缘点思路详解 bellman_ford求最短路)
题目 You are to find the length of the shortest path through a chamber containing obstructing walls. The chamber will always have sides at x = 0, x = 10, y = 0, and y = 10. The initial and final points ...原创 2020-01-31 19:44:49 · 235 阅读 · 0 评论 -
Arbitrage POJ - 2240(bellman_ford 判断正权环)
题目 Arbitrage 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.5 Bri...原创 2020-01-30 18:43:05 · 181 阅读 · 0 评论 -
N - Wormholes(Bellman_ford && spfa)
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 time that i...原创 2019-07-10 10:23:33 · 161 阅读 · 0 评论 -
Dijkstra
(1)一般是单起点问题,操作步骤就是选择起点vis标记 然后更新距离数组d 然后循环从d数组中选取最小值,作为新起点vis,更新数组d。重复n-1次。 (2)多起点多终点问题 初始化将所有起点vis标记 然后更新距离数组d,类似最小生成树,把多起点化为一个起点。 (3)如果是多起点唯一终点,可以转化成一般的单起点问题,逆向思考。 也可以就按照(2)来做。 以下是单起点的大概样子,具体情况具体改。 ...原创 2020-01-30 13:37:33 · 147 阅读 · 0 评论 -
Window Pains POJ - 2585(拓扑排序在覆盖问题中的运用)
题目 Boudreaux likes to multitask, especially when it comes to using his computer. Never satisfied with just running one application at a time, he usually runs nine applications, each in its own window....原创 2020-01-29 19:09:39 · 195 阅读 · 0 评论 -
Sorting It All Out POJ - 1094(拓扑排序 关系实时判断)
题目 An ascending sorted sequence of distinct values is one in which some form of a less-than operator is used to order the elements from smallest to largest. For example, the sorted sequence A, B, C, D...原创 2020-01-29 17:15:59 · 150 阅读 · 0 评论 -
AOV网络、AOE网络(拓扑排序)
判断是否可构成AOV网络,即是否存在拓扑序列 #include <cstdio> #include <cstring> #include <queue> using namespace std; int n, m; vector <int> p[110]; int inde[110]; int tp(){ queue<int> ...原创 2020-01-29 12:42:36 · 512 阅读 · 0 评论 -
Frogs' Neighborhood POJ - 1659(判读是否可图)
题目 未名湖附近共有N个大小湖泊L1, L2, …, Ln(其中包括未名湖),每个湖泊Li里住着一只青蛙Fi(1 ≤ i ≤ N)。如果湖泊Li和Lj之间有水路相连,则青蛙Fi和Fj互称为邻居。现在已知每只青蛙的邻居数目x1, x2, …, xn,请你给出每两个湖泊之间的相连关系。 Input 第一行是测试数据的组数T(0 ≤ T ≤ 20)。每组数据包括两行,第一行是整数N(2 < N &...原创 2020-01-28 17:54:39 · 129 阅读 · 0 评论 -
Andryusha and Colored Balloons CodeForces - 780C
题目 C. Andryusha and Colored Balloons time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Andryusha goes through a park each day. The squares a...原创 2020-01-15 15:53:17 · 209 阅读 · 0 评论