· Things

2018 Annual Summary

2018 was a small milestone in my life. What made this year so special was that I passed the high school entrance exam and got into high school. From Honggu Experimental to the High School Affiliated to Jiangxi Normal University, these two schools are where I spent this year. Honestly, my overall mood this year was really bad. In the first half, it was mostly anxiety and nerves before the high school entrance exam; in the second half, I was in a bad mood probably because the adjustment period was rather long, so there's not much to analyze. Still, I feel I've aged a lot after this year, and I guess there will be more and more times in the future when I find myself more and more weathered.

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

· Olympiad in Informatics

P3899: [Hunan Training Camp] Laughing and Chatting — Solution

"This is a big mistake!"

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

· Olympiad in Informatics

POJ2104: K-th Number — Solution

There isn't really much of an idea to this problem... it's just a template problem for the persistent segment tree: use prefix sums \(sum[]\) to maintain how many times the numbers appear between different versions, and that's it.

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

· Things

December Summary

December was pretty good.

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

· Olympiad in Informatics

P2414: [NOI2011] Ali’s Typewriter — Solution

What I really want to stress about this problem is reading in the string (I was stuck on it for an afternoon and an evening). We need to do the trie insert operation while reading the input, and not store the substrings! Otherwise you’ll MLE like I did. The code:

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

· Olympiad in Informatics

P2444: [POI2000] Virus — Solution

This problem is definitely going to be implemented with an Aho–Corasick automaton. After we put all these strings into the automaton with the insert operation, how do we modify the build_AC_automation operation to handle this problem?

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

· Olympiad in Informatics

P2002: Message Spread — Solution

This is a fairly bare Tarjan problem. We use Tarjan's algorithm to get the strongly connected components and condense them into a DAG forest, then just count the nodes with in-degree 0 in the DAG. Here is an excellent set of lecture notes on Tarjan's algorithm that I recommend: https://www.byvoid.com/zhs/blog/scc-tarjan

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

· Olympiad in Informatics

HDU2222: Keywords Search — Solution

This problem is just a template problem for the Aho–Corasick automaton. The Aho–Corasick automaton is meant for matching multiple pattern strings; in fact, it is a matching algorithm that runs on a trie. Here is an excellent set of lecture notes, which readers unfamiliar with the Aho–Corasick automaton can read on their own: https://blog.csdn.net/creatorx/article/details/71100840

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

· Olympiad in Informatics

P2106: Sam Number — Solution

This problem is more or less a template problem for matrix recurrences. If you're not very familiar with matrix multiplication or with how matrix-accelerated recurrences work, you can head over to this Wiki page: Matrices - OI Wiki. We can quickly come up with a DP equation, where \(i\) is the number of digits and \(j\) is the digit filled in the first position:

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

· Olympiad in Informatics

P3233: [HNOI2014] World Tree — Solution

This problem is simply a nightmare for anyone just learning virtual trees... I wrote a 30-point brute force earlier that got nowhere, so I turned to the solutions. I learned about a thing called a virtual tree, and only got AC after copying the solutions for a whole afternoon.

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