"Tsinghua training 2014" the main theme

"Tsinghua training 2014" the main theme

This problem is very difficult said than done, I think even an hour 50 minutes will not only guide the touch weeks.

We attempt to directly burst count set \ (S \) number of non-strongly connected induced subgraph, consider the all strongly connected components derived subgraph condensing the point must be a point \ (\ geq 2 \) a \ (\ the DAG} {text \) . After completion i.e. have a shrinkage of at least the \ (0 \) point, this condition sufficiency Obviously, if the degree of necessity to consider that there is no \ (0 \) point, then there must be a ring, and described He did not shrink away all strongly connected components. Then we enumerate the degree \ (0 \) set of points \ (T \) , denoted \ (F (T, k) \) is the \ (T \) into \ (K \) th strongly connected components program number, \ (CNT (a, B) \) represents a set of \ (a \) to \ (B \) the number of connected edges. We calculated repellent capacity can not legitimate program number
\ [Q (S) = \ sum_ {T \ subseteq S, T \ neq \ emptyset} (-1) ^ {k} F (T, k) 2 ^ {cnt ( T, ST) + cnt (ST
, ST)} \] legitimate program number is
\ [Ans (S) = 2
^ {cnt (S, S)} - Q (S) \] briefly explain this formula, we are not all good penetration is directly determined\ (0 \) is the point, where the inclusion and exclusion enumeration degrees \ (0 \) a subset of the point, its contribution to the answer is \ ((- 1) ^ k \) the rest of the side in addition to \ (T \) can be easily connected to the program number is no longer even later than that inside.

Here to use \ (F (T, k) \) , in fact, it is the soy sauce. In fact, we need only \ (K \) in accordance with the parity discussed, the maintenance is divided into an odd / even number of strongly connected components scheme \ (F (T, 0), F (T,. 1) \) , this thing can be maintained by \ (Ans \) to transfer, in order to avoid re-calculation, about enumeration \ (S \) the lowest number of points at which a strongly connected components
\ [Q (S) = \ sum_ {T \ subseteq S, T \ neq \ emptyset} [f (T , 1) -f (T, 0)] 2 ^ {cnt (T, ST) + cnt (ST, ST)} \\ f (S, 0) = \ sum_ {T \ subseteq S, T \ neq \ emptyset } f (ST, 1) \ times Ans (T) \\ f (S, 1) = \ sum_ {T \ subseteq S, T \ neq \ emptyset} f (ST, 0) \ times Ans (T) \]
where there is mutual transfer of some cases, but not difficult to find that only a strongly connected component often, although the degree of \ (0 \) but is a legitimate program, the first treatment \ (Ans \) and then update \ (f \) array can be.

Code is someone else's film, not posted.

Guess you like

Origin www.cnblogs.com/mangoyang/p/11614344.html