2019 TCO Round 1B
There are still many interesting DP questions on Topcoder, but it would be great if there were more editors (what are you going to do…)
EllysSki
The 250 question is too easy.
EllysTeleport
The 500 question was a question I originally asked when I was interviewing a certain company, and there was a possibility of encountering a loop.
2->1->5->6->7->8->5 is the case.
After thinking about it for a while, I first checked whether this point was on a loop and recorded the length of the loop.
Then scan it again and that’s it.
As far as the current problem is being dealt with, there will be no break down at all. Intellectual issues.
Of course, I just $N^2$ here.
1 | ll val[100005],nxt[100005]; |
EllysPearls
The meaning of the question 1000 is that each point has a color, and points of the same color are required to be placed together. Ask how many times the current order of these points needs to be changed.
The question explanation says that if 15 usually appears, consider bitmask dp. And this dp is actually very classic. It is [0,1] that indicates whether the current color has been added to the set and whether it has been considered. Then the color at the last position is recorded and it is over.
1 | int n; |
It happened to be the May Day holiday here recently, so I didn’t go home. I miss my parents very much and think about the decisions I have made independently over the years. Don’t know what to say either. I just hope that I will keep working hard. Please keep working hard.
One day, let them. . . Be proud of me. . .