· Olympiad in Informatics

NOIp 2016 Problem-Solving Report

A stupid problem; just do whatever.

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

· Olympiad in Informatics

NOIp 2017 Problem-Solving Report

A killer pattern-spotting problem. Of course you can also use the properties of exgcd; what follows is hand-wavy intuition:

Let this number be \(x \equiv ya {\pmod b}\); expanding it gives:

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

· Olympiad in Informatics

NOIp 2018 Problem-Solving Report

In the exam room I wasn't thinking straight on this one and banged out a segment tree, which got full marks (of course it doesn't need to be this complicated). Below is my code from the exam.

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

· Olympiad in Informatics

Generating Function

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

· Olympiad in Informatics

Greedy: Special Topic

My greedy is way too weak, so I'm summarizing a few models here, in case it's GG for me in the contest.

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

· Olympiad in Informatics

[Miscellaneous Problems] - October 1, 2019

This search is so slick.

First, just enumerate the 20 numbers to get the initial roots. Suppose we have found \(s\) roots; then we still have \(n - s\) left, and they must be repeated roots. So we consider directly searching for which repeated root each of the remaining \(n - s\) actually is. The complexity of this is \(\Theta(s^{n - s})\). As for how we verify that a solution is correct, that is the essence of this problem: consider writing this set of solutions in factored form:

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

· Olympiad in Informatics

[Miscellaneous Problems] - September 25, 2019

At a glance you can tell it is an articulation point problem. For a vertex that is not an articulation point, every pair counted must include this vertex itself, and since the pairs are ordered, the contribution is \(2(n - 1)\). If it is an articulation point, things are more troublesome; count it in the following parts:

  • Pairs extending out from this vertex.
  • Pairs between connected components.
  • Pairs that could not reach each other in the first place.

The first one is easy to count: it is \(2(n - 1)\). For the second, while Tarjan enumerates the search subtrees, compute the product of the subtree size and the size of its complement in the whole graph (note that this counts the pairs with vertex \(u\) one extra time, so we change the first one to count \(n - 1\)); for the third, compute the product of “the size of the complement of the current whole search tree in the graph” and “the size of the search tree”.

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

· Olympiad in Informatics

[Miscellaneous Problems] - September 21, 2019

kal0rona is getting more and more stupid.

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

· Olympiad in Informatics

[POI2007] BIU-Offices — Solution

I happened to have seen a result in “Combinatorics”: the vertices of a connected component formed in the complement graph are certainly connected everywhere in the original graph. The proof is simple: consider a vertex pair \((u, v)\). If the pair is not connected in the complement graph, then obviously it is connected in the original graph; if it is connected in the complement graph, there is a vertex not in the current vertex set that connects them. So we only need to build the complement graph and run a BFS based on “every vertex not adjacent to this vertex is in this connected component”.

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

· Olympiad in Informatics

[Miscellaneous Problems] - September 19, 2019

One look at the complexity: it is on the order of \(O(nm)\), so consider a DP with two loops. After analyzing the whole statement, we find that we cross a boundary if and only if the other connected component has a larger weight than the current one; otherwise we won't give up the current gold just to cross the boundary. So we do something like a DP: since each cell can only be walked through once, in each column you can only choose to keep going up or keep going down, so this DP has no aftereffects, and then handling the connection checks between connected components finishes it.

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