LCCUP 21 Fall Team
| Rank | Name | Score | Finish Time | Q1 (2) | Q2 (4) | Q3 (6) | Q4 (7) | Q5 (8) | Q6(9) |
|---|---|---|---|---|---|---|---|---|---|
| 81 / 1363 | 爸爸去哪儿 | 19/37 | 1:07:44 | 0:03:40 by 爸 | 0:21:39 by 爸 | 0:53:13 by 宝 | 1:02:44 🐞 1 by 爸 | null | null |
For this year’s fall contest, I only participated in the team contest, not the individual contest. In the spring contest, I teamed up with Uncle Lai and Brother Xianmu, and the result was not very ideal. In the fall contest, I teamed up with Baobao as a two-person team, and the result was actually quite good. In particular, Baobao not only did not slow me down, but also made an important contribution to the team. Without her smoothly solving Q3, our team’s rank would definitely not look as good as it does now.
After solving four problems in one hour, only five people AC’d the last two problems. After staring at them for a long time, we did not find any idea with a feasible time complexity. So we decisively gave up, and the last two hours were saved for doing something else.
Although I now use my English blog to write weekly contest summaries, both the spring and fall contests are events on the China LeetCode site, and only Chinese users can participate in and see them. So considering the audience, this contest summary was still written in Chinese.
LCP 44. Opening Ceremony Fireworks
A warm-up problem. DFS, using a set to record different colors.
1 | /** |
Time complexity: O(N),
space complexity: O(N).
Here, N is the number of nodes.
LCP 45. Bicycle Yard
DFS. Because height needs to be considered, pass height in as a parameter as well.
Use seen/visit to record visited states.
Because of the speed-change mechanism h1-h2-o2, the speed obviously cannot exceed maximum height + 1, so the number of states is also finite, roughly n\*m\*maximum height = 10^6.
1 | class Solution: |
Time complexity: O(m * n * maxTerrain),
space complexity: O(m * n * maxTerrain).
LCP 46. Volunteer Deployment
This solution was independently figured out and implemented by Baobao. Before implementation, we did discuss the approach and confirmed that it was correct before she started coding.
Set up equations. For each venue on each day, represent the headcount as (coefficient, constant). For example, on the final day, venue 0 is (1, 0), while the others are (0, number of people). Then derive backward and update the venue counts. When reaching the first day, solve the equation.
1 | class Solution: |
Time complexity: O(m * n * avg(edges)),
space complexity: O(edges + n).
LCP 47. Security Check
When I saw that the final answer could be very large and needed modulo, it was basically impossible to enumerate all cases. It was most likely a DP problem.
The next question was what the state transition should look like.
This problem is quite similar to the Josephus problem. The focus is the change in numeric indices when using stack/queue behavior.
Because it involves top-down DP and large-number modulo arithmetic, Python has an obvious advantage.
Although @cache is convenient, I often forget dp.cache_clear(), which caused one TLE penalty.
I need to pay attention to this in the future.
1 | class Solution: |
Time complexity: O(n * k),
space complexity: O(n * k).