A hybrid network flow problem

A. strange game

In the trellis diagram corresponding to the network stream often dyed black and white , of course, four-color staining something strange .

Construction Plan is not difficult, but the two points is a good idea.

Consider how to answer test a $ x $, the left part of the black point as a point bipartite graph, the right part of the white point as a point of bipartite graph.

One operation corresponds to a set of adjacent black and white dots $ 1 + $, it can be built directly run over flow chart would be finished.

Note, however, obviously only when the number of black dots = white point, the answer is monotonic.

However, for a number of black dots is not equal to the white point, the answer can only be a fixed value, as long as it checks a single point.

 

B. soldiers occupied

For the construction of FIG relationship between ranks, the ranks may be separately placed on both sides of bipartite graph, showing the intersection of the edge even ranks ranks.

The question is restricted to at least, it can be used for the lower bound of the minimum feasible flow to resolve.

The title does not use the upper bound of the provisions, a better solution is to place the conversion of up to at least placed,

That is the point of considering deletion process, which can be directly used to limit the maximum flow.

 

C. Emergency evacuation evacuate

Seems to be a common routine, the original graph nodes split in different states.

In this problem can be expressed for each time point demolition, and then can be directly built side just fine.

This problem can be determined by the size of the answers half the answer, another good fight (and perhaps also faster) approach is directly on the residual network add / plus side.

 

D. wolf caught rabbits

Minimum cut can too.

Of course, positive solution is a plan view of FIG dual rotation,

Each block is regarded as a plan view of a cut point in the dual graph,

Built between the block edges, i.e. the right side edge of the divided flow of the two blocks.

This thing just fine to understand (especially two-way traffic the same side), painting drawing enough.

 

E. cut cake

The same ranks must choose a point, so the points are concatenated to solve.

Restriction adjacent two points is a distance not exceeding $ d $.

Consider $ $ INF edge $ (a, b) $ role $ s-> a $ or $ b-> t $ a must be cut.

So for (i.e., adjacent) to each point limited $ (i, j) $, from $ k $ $ I $ of copies, the first $ $ $ J KD INF $ $ $ copy even side just fine.

 

F. Figure Eight

Because of the complexity of the allowed $ O (n ^ 3) $,

Monotone pointer maintain the maximum length corresponding to each interval,

Then the interval $ dp $ statistics look good, I find great God of network flow approach.

 

G. maximum profit

Select two points, corresponding to a return.

Regarded as the simplest maximum weight subgraph closed.

Because the number of income is not much, a new point for each income, even some $ inf $ sides just fine.

 

H. happiness

Or a maximum weight subgraph title closed, but on both sides corresponding to a different choice.

Because the number of income is not much, a new point for each income, even some $ inf $ sides just fine.

 

I. employ staff hired

Or a maximum weight closed subgraph problem, however both an option and not a change would correspond to a loss.

This time we can learn from the god of skill $ DC $ solving equations, by a strange edge to the right because the number is not much revenue, new revenue for each point, even some inf side just fine .

Because the number of income a lot, create a point for each income approach $ T $ out.

This time you can learn the tricks of the great God, built between cause side gains a point $ (i, j) $.

Specifically, each point separately even $ s $, $ t $, traffic and cost benefits resulting from the point, the point of selection for each.

Represents two cutting directions is not selected / selected, respectively.

So for $ (i, j) $ are selected, $ (i, j) $ are not election returns are correct.

For the $ (i, j) $ Select only one will cause earnings to get a multi / loss no statistics, so even the sides of between $ $ (i, j) $ $ (j, i) $ 2 * val_ {i , j} $ can count it a contribution.

 

J. Different minimum cut

It seems to be a data structure called minimum cut tree.

Algorithmic process is about:

The initial set point for the entire set.

Each take any two points in the set of $ a $ $ b $, Ran minimum cut between the two.

Built edges between $ a $ $ b $, is the minimum cut weight.

$ S $ $ T $ does not necessarily Unicom, the $ S $ $ T $ partition like a set of two, respectively.

The final cut between any two points, two corresponding cut tree, i.e., the minimum edge weight unique path.

This stuff does not prove it, but back good conclusion, the code good fight.

 

K. morning run

Direct split flow restriction point point, cost flow.

 

L. 80 people around the world

Upper and lower bounds of bare minimum cost feasible flow.

But do not here when this excellent algorithm.

So fucks out a strange algorithm.

Give some edge weights plus $ -inf $, so the premise of the minimum cost will flow over this edge, then the problem is solved.

$ HErk2 $ $ kx $ Great God told me that this approach does not expand very nature, it is $ five $.

However, $ cbx $ Tell me, upper and lower bounds for the cost flow, as long as the lower bound part with this approach, the portion between the upper and lower bounds like a normal stream, the god told me that this approach will very handsome.

因为大神$cbx$>$rk2$,显然$cbx$大神是对的。

 

M. 修车

刚开始考虑的是正向考虑,即正常人的思维方式,然后这个图就很不可建。

正解的做法是逆向考虑,倒数第$k$辆修的车,只造成了$k$倍修车时间的贡献。

所以将每个修车师傅拆为$n$个点,分别表示修的倒数第$k$辆车就好了。

 

N. 数字配对

又是一类套路题?

配对问题往往利用一些特殊性质,

划分为二分图的形式,分别连在$s$,$t$上,之间连边就好了。

该题中的划分表现为质因子个数的奇偶性。

 

O. 美食节

与《修车》一题的建图就比较类似,然而暴力建图必死。

然而本题中拆点的限制就表示,当倒数第$k$辆车还没修时(假设修车=做菜),倒数第$k+1$辆车是没用的。

所以在增广到某师傅修倒数第$k$辆车的节点的时候,新建第$k+1$个节点副本就好了。

Guess you like

Origin www.cnblogs.com/skyh/p/12007902.html