· Olympiad in Informatics

Codeforces Round #503 (by SIS, Div. 1) - Problem-Solving Report

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

· Olympiad in Informatics

Universal OJ#62. [UR #5] How to Run Faster — Solution

A beautiful, godlike trick, love it, love it.

Copying down the original equation:

\[\begin{equation} \sum_{j = 1}^{n} \gcd(i, j)^c \cdot \text{lcm}(i, j)^d \cdot x_j \equiv b_i \pmod{p} \end{equation}\]

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

· Olympiad in Informatics

LibreOJ#3144. [APIO 2019] Strange Device — Solution

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

· Things

Explosion Summary

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

· Olympiad in Informatics

LibreOJ#6374. [SDWC2018 Day1] Grid — Solution

A good inclusion–exclusion problem!

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

· Olympiad in Informatics

Lyft Level 5 Challenge 2018 - Final Round (Open Div. 1) - Problem-Solving Report

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

· Olympiad in Informatics

AtCoder Grand Contest 028E: High Elements — Solution

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

· Olympiad in Informatics

[LibreOJ NOI Round #2] Inequality Relations — Solution

This problem is so godlike.

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

· Olympiad in Informatics

Codeforces Round #511 (Div. 1) - Problem-Solving Report

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

· Olympiad in Informatics

[FZOI] OI Weekly Contest #6 Div.0 - Solution

A problem set that was very comfortable to work through.

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