T1
Violence 50 points:
K run times of no wrong dij
It seems to be a tree
There may be forest
Maybe we can do it when the tree
Correct answer:
We enumerate the two nearest point number
Since int representing two different, it means that there is at least one different on their binary representation.
Enumeration is assumed to bit i, which put a point source 1 is set, for which a 0 is set to point to the sink
Then run multi-source multiple sinks shortest
It is to set a super source s, a super sink point t
s is connected to each source point to the right side edge of 0, all connected to the sink side to the right side of t 0, and then run a single source shortest
T2:
Processing the maximum weight (arriving B FS) (instead of D FS)
tarjan contraction wave points, dp on to a DAG
Code Gugu Gu
T3
violence:
Since 20% of the data is not more than 5 kinds of colors, so we can open five segment tree
I opened the frenzied 100 segment tree
that's nice
Contribution 100 tree line optimization
Not for (1 ~ 100)
But for c [l] to c [r]
Such complexity is O (nlogn) of the
Mo was forced online
All operations are read into the coming
Review: 1 removed from the collection of colors, the color was added from a set of 2
Therefore, in accordance with the color order, the processing time of each operation sequence
This will only need one line of the tree
No chain tree split:
Right right point on the path of a node plus a value considering the tree x, and to calculate a point to the root and
When u + x, and the upper point of the right subtree of the u point in the path to the root are + x.
If you do not split the chain tree, ran over ordinary dfs order.
Dfs order to ensure a common point of sub-tree is the interval between the first and third this point appears
We still use tree line and to maintain the interval.
When the weights point u + x, the line segment tree, the whole range of answers + x
V u to find the right point of the path and: u + v to the root to the root to the root -2 * lca + lca of
First so be it qwq