Graph Theory classic examples Awards

BZOJ 1614 to set up a telephone line

The maximum value of the minimum! ? Bipartite

Dichotomous answer:

Suppose takes mid-membered, can be used to see if the cost of the mid-membered 1 ~ n.

For w <mid, without free, 0

For w> mid must be free, 1

From there Can 1 ~ n <k Right side bar

With more than 0/1 of the principles established chart.

For the most short-circuit (short-circuit is most a few will contain a few, and containing a minimum of 1), if disN <= k is feasible

BZOJ1083 busy city:

https://www.luogu.org/problemnew/show/P2330

Minimum spanning tree run again on the line;

Violence O (C M k) will obviously be fried

How to solve the problem of k = 1

Lift it out:

Copy the original again, and then even have the right to Collage 0, run the shortest path;

K edges:

Copy over k, 1 from layer 0 to layer k-w shortest! ?

Finally into 1 => (k-1) * n + n is shortest;

int d(int k,int i){

return (k-1)*n+i

}

Wormhole: negative-side, the path: the positive-side;

Negative ring => You can return to the past;

Forfeit ring: if a click-throughs team> = n; has a negative ring; you can return to the past

On average, average into two teams on it; the number of times each point into the team is relatively small;

Suppose a small, but may be card number into the team assumed> = a constant, it is possible to have negative ring;

Single-source shortest run twice, respectively A, B as a starting point, intermediate point to find a minimum of x, such that the smallest dis (A, x) + dis (B, x), wherein:

Built map:

For each set, a new node, all the nodes in the collection to the new node is connected to one side of the right side of t (t is an arbitrary two points within the set of mutually time), by the new node is connected to a set point to the right side edge 0; then ↑

Intuitive feel dfs according sequential operation, must be optimal;

Dfs sequence according to a sequence of rows of treasure, the LCA is obtained between each two adjacent, then find the shortest path, and finally requires first and last of the shortest path;

Insert: insert in a, b a c satisfy a <c <b;

- the shortest path (a, b) + the shortest path (a, c) + the shortest path (b, c);

Bi, j large bit too much;

Cheng Si also 300

Then we established a three-dimensional map

对每一条连边,使之边权为1,然后连一条从底部到最上权值为0的边。

以三点中任意一点为源点,对另两个点求最短路?

 下午;

可以让m条边按照g作为第一关键字,s作为第二关键字排序

然后从小到大枚举maxg,把g小于maxg的边放入可用边的集合中

每次枚举后,在可用边中,按照ss排序

用(kruskal)求出最小生成树

可以发现,在前面的枚举中没有用上的边,在后面也不可能被(kruskal)用上,所以可用边最多保留n条

复杂度O(n×m)

然后因为gugugu,所以安利博客:here

题面实际上求的是平面图的最小割;

平面图的最小割等于其对偶图的最短路;

平面图:就是可以摊在二维平面中并且边不交叉;

割:找边集使得把这些点删掉以后源点和终点不连通。

最小割:所有割中,边权之和最小的割;

对偶图:对于每一块平面,把它看做一个点,然后对于对偶图的边,一定会与平面图的边有交点;

那么求出对偶图,跑一个最短路就好了;

 鸣谢jyy

求一个环,满足这个环的点权之和/边权之和最大;

把点权看做边权第二维,然后变为有二维的边权,原题变成求一个环,满足边权第二维之和/边权第一维之和最大;

 

然后二分t,通过看是否有一个环满足上面最后一个式子,如果有,说明答案可行,将t值缩小;

如果没有,说明不可行,将t值增大;

简单来说:

把原图每条边变成Fl-tTl,如果有负环,答案可行,t变小;

最优比例生成树:(因为要写式子,所以gugugu)

显然所有的强连通分量里的钱都可以抢走,把每个强连通求出来,缩成一个点,从点1所在的强连通分量,跑一遍求最长路的SPFA,然后判断是否有酒吧,把有酒吧的取一个max

点数≤100,边数≤1000000(打错了↑)

SOLUTION:

倍增Floyd&Floyd快速幂(懵)

g1[i,j] 从i到j只经过一条边的最短路

g2[i,j] 从i到j只经过一条边的最短路

枚举所有中点k

g2[i,k]=min(g1[i,k]+g1[k,j]);

g2[i,j]=>g4[i,k];

gp[i,j]=min(gp/2[i,k]+gp/2[k,j]);

如何求g19:g3=max(g2[i][k]+g1[k][j]),

g19[i,j]=max(g16[i,k]+g3[k,j])

 Dwstroying Road gugugu

Guess you like

Origin www.cnblogs.com/zhuier-xquan/p/11197361.html
Recommended