13 October

Tree chain split

http://www.lydsy.com/JudgeOnline/problem.php?id=1036

https://oi.men.ci/tree-chain-split-notes/

Dotted rule

https://oi.men.ci/tree-divide-notes/

https://www.luogu.org/blog/chengni5673/dian-fen-zhi

The number of paths for a tree, path length x of the statistics.

Dotted rule: find a point of roots and statistical answer, then it will separate sub-tree, respectively, the same operation, continues until only one point where the roots are required selection, in order to ensure that the time complexity. we need to try to make the sub-tree of similar size, so every time we have the best selection of root of this tree is the current center of gravity.

Common techniques of graph theory

  • Built reverse side
  • Even dotted edge

Optimization Graph 1. Each request set point to the specified point of the shortest distance


(a)



(b)

Graph 2. FIG complete bipartite construction side optimization

  • Built side tree line optimization

Graph 3. built side tree line optimization

  • Split point
  • FIG layered FIG solve tricky operation

There is a hierarchical view of the multi-dimensional state diagram has side length than the shortest normal transfer interdimensional shift more of a state transition. Usually lay down a side length, rounded up to the number of times (less frequently).

[JLOI2011] flight path: Alice and Bob now travel by air, they chose a relatively cheap airline. The airline has a total of n operations in cities, the city set labeled 0 to n-1, a total of m kinds of routes, each route connecting the two cities, and routes certain price. Alice and Bob are now arriving from one city to another city along the route, the way you can be a turning point. Airlines also launched on this trip they offer, they can be free on up to k kinds of routes to fly. Alice and Bob then this trip is the minimum amount to spend?

分层图可以很巧妙的解决这个问题. 想象你每次使用免费航线之前和之后分别存在于不同的时空 (不同的层) 里面,每使用一次免费航线,你就从这个时空进入了另一个时空 (免费). 根据以上思想建图,一共建 k+1 层图,相邻的两层图中进行连边 (单向边,距离为 1). 然后跑 Dijkstra 即可.

gaotianyu1350

图论的注意点

  • 无向图/有向图
  • 自环、重边
  • 环(缩点)
  • 负环、零环

Guess you like

Origin www.cnblogs.com/greyqz/p/11668793.html
Recommended