· Olympiad in Informatics

P1137: Travel Plan — Solution

I haven't written a topological sort in ages. Today I looked at this problem for ages, and from the solutions it turns out to be a DP over topological order. The principle is to do the DP following the topological order. Since no vertex in a DAG can loop back, we only need to head straight down, using dp[x] to record the places vertex x can reach. Using a topological sort means that, during the DP, nothing ends up affecting other nodes that have already been computed.

Continue reading →Chinese original · English translation by Claude Opus 5.5

· Olympiad in Informatics

P1122: Maximum Subtree Sum — Solution

Let F[n+1] be the array for the tree DP. At node i, for every child j, we have F[j] = dis[i] + max(0, F[j]). Here dis is the beauty index.

Continue reading →Chinese original · English translation by Claude Opus 5.5

· Olympiad in Informatics

P2678: Jumping Stones — Solution & the Principle of Binary Search on the Answer

This problem was handed out when I was training with the godlike elementary schoolers over the summer, and I never knew how to solve it. A month ago the big shot crazydave gave me a quick rundown of how binary search on the answer works, and I, a weakling, only got it all sorted out today.

Continue reading →Chinese original · English translation by Claude Opus 5.5

· Things

A Terrible October

This month, I went through a lot of terrible things.

Continue reading →Chinese original · English translation by Claude Opus 5.5

· Olympiad in Informatics

P1351: Joint Weight — Solution

I originally wrote this problem with brute-force search (DFS), but it got TLE on 3 test cases. I had no choice but to go ask lornd, a big shot in our computer lab, for help. Under his magical moves, this problem went from \(O(n^3)\) to \(O(n)\) time complexity.

Continue reading →Chinese original · English translation by Claude Opus 5.5

· Olympiad in Informatics

P1141: 01 Maze — Solution

After thinking about it for a long time (actually, understanding the solution), I worked out how to solve this problem. It is mainly an extension of the disjoint-set union plus some preprocessing. While reading in the 01 maze, we check whether the point on the left and the point on the right are connected. If they are, we merge them in the DSU, and just add up the connected-component counts in the DSU.

Continue reading →Chinese original · English translation by Claude Opus 5.5

· Olympiad in Informatics

NOIp 2018 Preliminary Round Log

Done for.

Continue reading →Chinese original · English translation by Claude Opus 5.5

· Olympiad in Informatics

Dilworth's Theorem and the Missile Interception Problem

This is a problem I thought about for a long time, probably because I'm too weak. Let's first analyze the problem.

Continue reading →Chinese original · English translation by Claude Opus 5.5

· Things

Notes on the 2018 Sports Day

I've come to a new place, and a lot of things are different from before. In the first week I got familiar with the campus, in the second week I started matching wits with the dorm supervisors, and in the third week I started seriously working on problems.

Continue reading →Chinese original · English translation by Claude Opus 5.5

· Things

Starting to Write Posts

I finally got WordPress deployed and successfully put the thing up on a cloud server. The domain name may still need some time to resolve, but today's work is satisfying after all.

Continue reading →Chinese original · English translation by Claude Opus 5.5