· Olympiad in Informatics

U63113: Invasion - a.k.a. “XG's Math Problem”

As everyone knows, XG_Zepto is a god from FZOI. He thought the current contests were too easy, so he used his Minesweeper time to set a math problem for kal0rona. kal0rona is way too weak to understand the problem or solve it, so now he's turning to you for help.

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

· Olympiad in Informatics

POJ1037: A decorative fence — Solution

This problem is a really good one among counting DPs.

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

· Olympiad in Informatics

CH3401: Stone Game — Solution

Yep, this problem is a nasty problem. First, we can establish that these sequences will all start over from the beginning within \(60s\), because the greatest common multiple of \(1,2,3,4,5,6\) is \(60\). After that, we can consider putting these operations into an operation matrix. The operation matrix is \(n*m\) in both length and width. The specific operations correspond as follows:

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

· Olympiad in Informatics

CH3602: Counting Swaps — Solution

This is a good problem: it uses graph modeling, and you could say it is truly exquisite.

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

· Olympiad in Informatics

POJ1737: Connected Graph — Solution

The counting equation and the idea behind this problem are really interesting; let's start the analysis below.

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

· Olympiad in Informatics

[Codeforces 559C] Gerald and Giant Chess — Solution

This problem is actually pretty nice, so let's analyze it.

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

· Olympiad in Informatics

Educational DP Contest: I - Coins — Solution

Probability DP, obviously.

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

· Olympiad in Informatics

Educational DP Contest: J - Sushi — Solution

Ahh, I'm so weak.

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

· Olympiad in Informatics

BZOJ2818: GCD — Solution

At first glance, this can actually be tied to Euler's totient function. What we want is the number of ordered pairs with \(gcd(x,y) \in Prime, x, y \leq N\). Let that prime be \(s\); then it can be rewritten as:

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

· Olympiad in Informatics

P3914: Counting Colorings — Solution

This problem is fairly interesting. At first I came up with an \(O(n^3)\) complexity, and after typing it up and getting TLE I thought about the prefix-difference approach, but I was too naive and didn't quite trust (?) subtraction under the modulus, so I only got this idea working after reading the solutions.

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