51nod filling in holes (3)(1203,1695)
It’s actually over one o’clock now. . . If you don’t summarize the question, you haven’t done it.
51nod 1203
Through this question, I reviewed Captain Mo again, but I had forgotten many of them.
For prime numbers <230, you can use RMQ, and you will find that there are only 50.
The discovery of prime numbers > 230 is only possible with 0 or 1, Team Mo.
1 | int num[maxn]; |
51nod 1695
Dreamoon’s question was asked a long time ago.
The meaning of the question is that given a tree, each edge on the tree has a corresponding weight. Each point has a maximum value $R_x$ to other points. Given a len, find a point set where the maximum difference between $R_x$ is less than len. Find the maximum value of this point set.
Not at all, after thinking about it for a long time, not at all. . .
First, consider finding $R_x$ for each point, which is the maximum value of the two points from each point to the diameter of the tree. This is no problem, it is within the scope of meeting. . .
How to find this maximum point set? It’s impossible. . . . . . . . . .
It turns out that I am looking for the root of the tree, recorded as r, and I found that $R_x - R_r < len$ is OK. I thought so. . .
Then came the method of checking scores on trees. It was my first time to think about it and it was very clever.
Go up from this node to the unreachable node -1, and get +1 here. Each time, points that meet the conditions within its own subtree are added.
Wow, this is a great question. . . .
1 | int n; |