Summary: Note: All the following instructions are intended to help you understand the template and are not guaranteed to be correct. Some pitfalls: the range of fft, whether the array is empty, how many powers of module x (all polynomials in the same formula must be polynomials in the sense of the same module $x ^ n $), the polynomial inversion is known $A (x) $, and the B satisfying $A (x) B (x)=1 (mod x ^ n) $(let's assume that n is a power of 2 for convenience) is multiplied, read the whole passage
posted @ 2019-07-10 09:50 Ressed Reading (244) Comments (0) Recommended (0) edit
Summary: Note: All the following instructions are intended to help you understand the template and are not guaranteed to be correct. The maximum flow dinic considers finding and expanding a path from S to T each time, but needs to solve the problem of looping, so first use bfs to layer your network, and then use dfs according to the layer (each point can only go to the point of the next layer), so as to maximize the flow to the current arc: in a dfs, each point has been visited read the whole passage
posted @ 2019-07-05 10:08 Ressed Reading (557) Comments (3) Recommended (1) edit
Summary: Miller_Rabin quickly ($O (slogn) $, s is the number of attempts) tests whether a number is a prime number. First, there is Fermat's Little Theorem $a ^ {p-1}=1 (mod p) $. When p is a prime number, it is true, so you can randomly select a to use this formula as a basis for judgment, but not all composite numbers do not meet this formula, and even there are composite numbers that do not meet this formula for all a and then there are two read the whole passage
posted @ 2019-06-24 13:33 Ressed Reading (228) Comments (0) Recommended (0) edit
Summary: In practice, consider using a ray (a point and a vector) to represent the half plane on its left side. Then we can first press the angle between the positive half axis of the x-axis (using atan2 (y, x) Realize) sorting, and then use the double end queue to maintain the ray currently in transit. The reason why the double end queue is used is that when a new half plane is inserted, the head and tail of the team may be popped out, and it should be noted that the tail of the team should be popped first, then the head of the team should be popped last, and then the head of the team should be popped one read the whole passage
posted @ 2019-06-20 14:15 Ressed Reading (190) Comments (0) Recommended (0) edit
Summary: Min max exclusion: $$max {a_i }= sum limits_ {S} (- 1) ^ {| s | - 1} min {a_i | a_i in S } read the whole passage
posted @ 2019-06-07 16:23 Ressed Reading (231) Comments (0) Recommended (0) edit
Summary: It is to calculate the number of connected blocks. You can maintain an oblique scan line. Only points in the R range are reserved in the set. However, how can you maintain connected blocks.. In fact, you only need to connect the edges to the leftmost and rightmost points that can be reached. The remaining points are already connected before read the whole passage
posted @ 2019-05-02 17:29 Ressed Reading (253) Comments (0) Recommended (0) edit
Summary: Consider the black and white coloring of non obstacle points and then do the maximum matching of bipartite graphs. Then it is concluded that the first hand will win if and only if it is not a perfect match, and the points that can be put are those that can not be matched starting from the non matching point, and the second hand can only go to the matching point, so the first hand can go to the matching edge. Since the point that cannot be walked through is now a non matching point; This continues until there is no way for the next player to go, so the first player will win read the whole passage
posted @ 2019-04-27 15:53 Ressed Reading (204) Comments (0) Recommended (0) edit
Summary: The principle defines two attributes for each point on the automaton: [min, max] and right set. This point represents (the length is within [min, Max], and the set of right endpoints of all occurrence positions is a substring of right). Then it can be proved that the right sets of two nodes are either disjoint or contain each other, so that the point that right directly contains (the right of a point) as its father can get read the whole passage
posted @ 2019-04-26 13:48 Ressed Reading (186) Comments (0) Recommended (0) edit
Summary: Usage The principle of balanced tree (which can realize interval flipping) is the same as that of tree. The middle order traversal represents the order of weight values, and each point has a random added value, forming a heap to ensure complexity but not rotation. All operations are divided into two types by split and merge: by weight and by ranking code luogu3369 Ordinary balanced tree read the whole passage
posted @ 2019-04-13 09:33 Ressed Reading (270) Comments (0) Recommended (0) edit
Summary: When the number of colors is relatively small, the first question can be directly Steiner tree and the second question can be divided into two points. Each time, the weight of each cell is given as 1000+[a [i]>m], that is, on the basis of the minimum number of colors, try to choose the ones less than or equal to m, but too many colors can not be directly done, but each color can be mapped to within 5. In this way, The correct rate of doing it once is the probability that the five colors as the answers are mapped to 1-5, which is $ frac{ read the whole passage
posted @ 2019-03-28 11:00 Ressed Reading (249) Comments (0) Recommended (0) edit