<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Algorithms on Jasper</title><link>https://jasper-aa64.github.io/algo/</link><description>Recent content in Algorithms on Jasper</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Mon, 02 Nov 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://jasper-aa64.github.io/algo/index.xml" rel="self" type="application/rss+xml"/><item><title>A1: Complexity, Binary Search, Two Pointers, Prefix Sums</title><link>https://jasper-aa64.github.io/algo/a1-complexity-binary-search-two-pointers-prefix-sums/</link><pubDate>Thu, 29 Oct 2026 00:00:00 +0000</pubDate><guid>https://jasper-aa64.github.io/algo/a1-complexity-binary-search-two-pointers-prefix-sums/</guid><description>&lt;p&gt;All four topics in this round answer queries on an array, and all of them bring brute-force $O(n^2)$ down. Two properties make that possible: monotonicity (binary search, two pointers) and accumulated quantities that can be subtracted (prefix sums, difference arrays). Complexity comes first because it decides which direction to think in.&lt;/p&gt;
&lt;h2 id="1-complexity-read-the-limits-first"&gt;&lt;span class="h-num"&gt;1.&lt;/span&gt; Complexity: read the limits first&lt;/h2&gt;
&lt;h3 id="11-from-the-limits-to-the-complexity"&gt;&lt;span class="h-num"&gt;1.1&lt;/span&gt; From the limits to the complexity&lt;/h3&gt;
&lt;p&gt;C++ does roughly $10^8$ simple operations (additions, comparisons, array accesses) per second. Once the problem states the bound on $n$, the acceptable complexity is mostly fixed:&lt;/p&gt;</description></item><item><title>C0: Mathematics in Contests</title><link>https://jasper-aa64.github.io/algo/c0-contest-math-overview/</link><pubDate>Fri, 30 Oct 2026 00:00:00 +0000</pubDate><guid>https://jasper-aa64.github.io/algo/c0-contest-math-overview/</guid><description>&lt;p&gt;In the mathematics problems of the second half of a contest, the hard part is rarely the theorem itself. Most theorems can be memorised; what goes wrong is not seeing which one a problem needs, or seeing it and failing to derive a form that can be coded. So this post is ordered by what you do in a contest rather than by theorem: first how to approach a mathematics problem at all (section 1), then number theory, counting and linear algebra, with each tool described by what it solves, which signal in the statement points to it and how its formula is derived (sections 2 to 4), and finally three problems written from the statement up (section 5).&lt;/p&gt;</description></item><item><title>L2: XOR Basis</title><link>https://jasper-aa64.github.io/algo/l2-xor-basis/</link><pubDate>Mon, 02 Nov 2026 00:00:00 +0000</pubDate><guid>https://jasper-aa64.github.io/algo/l2-xor-basis/</guid><description>&lt;p&gt;Given $n$ numbers, pick any subset and XOR it together: what is the largest result? With $n = 50$ there are $2^{50}$ subsets, too many to enumerate. But the subset XORs repeat a lot. With three numbers $a$, $b$, $a \oplus b$, the values you can reach are exactly the ones you reach with $a$ and $b$ alone; the third number is redundant. Remove redundant numbers one at a time and at most 60 remain (each number has 60 bits), yet not a single reachable value is lost. What remains is an &lt;strong&gt;XOR basis&lt;/strong&gt; (线性基). To say precisely what &amp;ldquo;redundant&amp;rdquo; means, and why at most 60 remain, we put XOR into linear algebra.&lt;/p&gt;</description></item></channel></rss>