Day 1
Toy
Water problem does not explain running
This sort of game is really problematic, and the problem is actually the hardest one in two days.
Each player x−y x-y path, set L=lca (x, y) L=lca (x, y), can be divided into x−l,l−y x-l,l-y
Let's look at the first type
If there is a point K K, the X−l x-l path can contribute to this point, then must meet
DEEP[X]−DEEP[K]=TIME[K] Deep[x]-deep[k]=time[k]
Can obviously move items
DEEP[X]−TIME[X]=DEEP[K] Deep[x]-time[x]=deep[k]
Then both sides are independent, in X x and L, respectively, add and subtract marks, maintain a bucket, and then run Dfs Dfs, then before entering the subtrees tree with the addition of the subtrees tree after the mark of the difference, that is the point of the answer.
Scenario 2 similar treatment
Of course, this thing you can also hit a line tree merge and other things to get, some large (SHA) cattle (BI) actually hit the chain-profile ... Classroom
The question should be the simplest except for the first question of two days.
Words Noip unexpectedly test expectations.
It's obvious that DP DP is possible.
Set f[i][j][0,1] f[i][j][0,1] indicates the minimum consumption of Class I, with J-J Chance, 0 0 for application, 1 1 for not applying
Run a Floyd Floyd first
Consider transfer
This course does not apply, it must be in the original classroom, application, there is a certain probability in another classroom.
Transfer can come directly, the last class selected, not selected, this class election, not selected, push a bit better. Day 2 problem
Yang Hui triangle pretreatment, and then get a prefix and can, I am more stupid, ask is O (n) o (n), but can be casually push a push O (1) O (1) Ask earthworm
That's a big hole in your brain.
Have a nature
First cut off the earthworm must be cut off after the earthworm long (obviously), after cutting, the first cut off the earthworm and the subsequent cut of the earthworm corresponding to the two pair to come longer than the first .
What do you mean?
For example, two earthworms long x,y,x>y x,y,x>y
X1,x2,y1,y2 X1,x2,y1,y2 after all the cuts.
X1>y1