Codeforces Notes
121B: Lucky Transformation
Note that when we are a 447 or 477 at the starting at the odd position, we run into an infinite case. Therefore, we just need to detect such infinite case.
61D: Eternal Victory
Notice it is a connected graph with n-1 edges, so it is a tree So we have 2 cases:
- cover all nodes and then return to the root
- cover all nodes and without returning to the node
so we can just DP on these 2 cases
487B: Strip
when we start from the left, and expanding, when we first reach the case where max - min > s, we will have to break current strip into two. To maintain max flexibilty for later choices, and satifies the min length requirement, we will just keep the last violating one