· Olympiad in Informatics

Roots of Unity Filter

When solving a counting problem, if you run into a condition requiring \(x \bmod m = 0\), and the formula is expensive to compute but contains binomial coefficients, you can consider using the roots of unity filter.

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

· Olympiad in Informatics

P3978: [TJOI2015] Probability Theory — Solution

First time doing this type of problem. Badass, badass (fist-palm salute).

First consider how to compute the denominator: if \(f_i\) is the number of distinct trees of size \(i\), then we obviously get \(f_i = \sum_{j = 0}^{n - 1} f_j f_{n - j - 1}\). Having got this far, divide-and-conquer FFT? No, the data range reaches an astonishing \(10^9\), so divide-and-conquer FFT is obviously impractical. We can keep deriving:

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

· Olympiad in Informatics

Polynomial Square Root

Following the doubling idea from polynomial inversion, we can write a derivation like this: suppose we already know that, under \(\pmod {x^{\lceil \frac{n}{2} \rceil}}\), we have found \(B'(x)\) as the current solution, and now we want to step up to \(\pmod x^n\). Then we can write

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

· Things

January Summary

This month went really badly, so I'll just write up a play-by-play to keep a record of it.

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

· Olympiad in Informatics

[Miscellaneous Problems] Late January

I've been lazy as hell lately, so I haven't updated the blog much. Let me put together a small collection here.

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

· Things

To be flexible

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

· Olympiad in Informatics

[Fortuna OJ] Jan 13-14 Problem Set

I forgot to write solutions, but I always felt I should write something, so here is this problem set.

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

· Olympiad in Informatics

[Fortuna OJ] Jan 12 Provincial Selection Division – Problem-Solving Report

No matter how safe you feel, once the contest is over you’ll still have lost points, and you’ll find that a slight tweak can fucking add dozens of points. That’s life.

kal0rona

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

· Olympiad in Informatics

[Fortuna OJ] Jan 11 Provincial Selection Division – Problem-Solving Report

GG in a contest is independent of one's own will.

kal0rona

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

· Olympiad in Informatics

[National Training Team 2011 Yangtian] Problem-Solving Report

Since it's a permutation, while reading the input we can place the values seen so far on a number line, and we find that a single symmetric pair is enough. We can use the idea of hashing to heavily mod a Fenwick tree, maintain the hashes of the string and of the reversed string, and then just compare them.

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