Div2 A: Water question
Div2 B: change each number to 1. the required number of steps is the F value of this number (the odd number minus one and the even number is divided by 2)
Div1 A: record the highest current height.
Div1 B: Sb question, there will be many points with the same X coordinate, but there may be some key points, so multiply the CNT! /(2 ^ c). Because the total CNT size cannot exceed 100000, it is acceptable for each brute force operation. At first, I was wondering if there were any modulo obtaining skills .....
Div1 C:
It seems to be the original question. I will give you a picture. Each vertex has no more than three degrees. You need to divide the vertex into two groups, so that no vertex in each group has> = two adjacent contacts in the same group.
Solution: assume that all vertices are in the same group, and then constantly find invalid vertices in the two groups and put them in another group (just search for them)
Proof: assume that the total number of edges with the same color as the two dots is m, and an invalid vertex u is found each time. There are three situations:
1: U has three adjacent contacts and the color is the same as U, then u into the opposite color will make M-3
2: U has two adjacent contact color and U is the same, another difference, then u into the opposite color will make the M-1
3: u only has two adjacent contacts, changing u to the opposite color will make M-2
To sum up, changing an invalid point to the opposite color will reduce the number of M, so the number of running algorithms is at the O (m) level.
Code
PS: the above two questions are both tests of the computing complexity capability, but the brute-force algorithms are actually not.
Div1 D:
Div1 E: