Doing it directly isn't easy, and I was pretty baffled. We can enumerate the number of votes the CCP gets, then grab one vote from each of the major parties. If grabbing those isn't enough, just grab the smallest votes. Then take the min over all of this and we're done.
Continue reading →Chinese original · English translation by Claude Opus 5.5
I derived three bogus cycles on my own, and so off I ran to the solution.
First, let the period be \(k\), and consider the final state \(x = 0, y = 0\). We consider what kind of period can go through one iteration and give the same state \(x = 0, y = 0\). We might as well substitute \(k\) directly:
\[x = (k + \lfloor \frac{k}{B} \rfloor) \bmod A, y = k \bmod B\]
Continue reading →Chinese original · English translation by Claude Opus 5.5
These past few months have been really strange: OI, my mindset and the appliances at home all blew up. The incoming neutral line was washed out in a heavy rainstorm, leaving the remaining three-phase live wires side-stepping back and forth, which doubled the voltage, and then, unsurprisingly, the whole household blew up. We lost three chargers and a microwave, plus a pile of light bulbs. After my laptop charger burned out I couldn't do any problems for the past two days, until this morning, when the new charger from a certain Dong finally arrived.
Continue reading →Chinese original · English translation by Claude Opus 5.5
Let's set aside the business of the \(k\) illegal vectors for now. First, consider knocking out that jump limit in the two dimensions separately, then knock out the cases of not moving.
For the jump limit in one dimension, taking the \(x\) axis as an example, we can turn it into an inclusion–exclusion over binomial coefficients:
Continue reading →Chinese original · English translation by Claude Opus 5.5
It turns out that only the horizontal lines starting from the far left can contribute. When computing the answer, consider enumerating the vertical lines we cross, then update the answer.
Continue reading →Chinese original · English translation by Claude Opus 5.5
A godlike problem, a nice one about flexibly using segment trees and greedy. First, an obvious property: string \(X\)'s \(\max\) sequence is a prefix of the original string's \(\max\) sequence. Once we know this, we can start constructing.
Continue reading →Chinese original · English translation by Claude Opus 5.5
First, let me introduce a brute-force standard trick (although it has nothing to do with the intended solution, I think it will come in handy in a lot of contests): we let \(f[i][j]\) be the contribution where, among the first \(i\) numbers, the current one is the \(j\)-th smallest, and then we have
Continue reading →Chinese original · English translation by Claude Opus 5.5
You can probably figure out that we first divide all the numbers by the GCD and then count the prime factor that occurs most often. We use the sieve of Eratosthenes to find each number's smallest prime factor, then just divide by brute force and mark them.
Continue reading →Chinese original · English translation by Claude Opus 5.5