This is the contest notebook for A Succulent Chinese Algorithm (Indra Kusumah-Kasim, Alex Yu, and Parsa Pordastan) at Monash University. It is a personal/team fork of KACTL, KTH's ICPC team reference: copy-pasteable C++ for ICPC-style contests. Unlike upstream, this notebook is not kept to a 25-page cap.
Two artifacts ship from this repo:
- Typeset notebook: kactl.pdf (rebuilt on every GitHub Pages deploy). A possibly older copy also lives at kactl.pdf in this repo.
- Snippets site: frex-e.github.io/kactl — a searchable, PDF-like view of the same
content/tree (chapter order, prose, copy / copy-with-deps).
Local algorithm changes relative to upstream are listed in agents/fork.md.
| Path | What |
|---|---|
| content/ | Notebook source: chapters, snippets, team page (content/kactl.tex) |
| web/ | Snippets site (Vite + React). See web/README.md |
| stress-tests/ | Stress tests run by make test |
| agents/ | Notes for coding agents working in this repo |
| agents/fork.md | Local snippet additions, replacements, and API deltas vs upstream |
make help lists build and test targets.
KACTL algorithms should be: useful, short, fast enough, well tested, and if relevant, readable and easy to modify. They should not be overly generic, since code is manually typed and that just adds overhead. This fork does not drop snippets just to stay under upstream’s 25-page ICPC limit.
While KACTL is usable as is, it's also easy to modify if you want to create a personalized copy. In particular, you may want to change the cover page, or make your own choice of algorithms to include. You may also want to enable colored syntax highlighting.
content/kactl.tex is the main file of KACTL, and can be edited to change team name, logo, syntax highlighting, etc.
It imports chapter.tex files from each of the content/ subdirectories, which define the contents of each chapter.
These include source code, text and math in the form of LaTeX.
To add/remove code from a chapter, add/remove a corresponding \kactlimport line from the chapter.tex file.
For nicer alignment you might want to insert \hardcolumnbreak, \columnbreak or \newpage commands,
though this is usually only done before important contests, and not on the main branch.
The algorithms that are not included in the pdf are left commented out in chapter.tex.
To build the notebook, type make kactl (or make fast) on a *nix machine -- this will update kactl.pdf.
make web-pdf is the same two-pass PDF without test-session.pdf, and is what GitHub Pages uses.
Both run make preprocess first (listings + snippets.json), then copy the PDF to web/public/kactl.pdf for the snippets site (that copy is gitignored).
(Windows might work as well, but is not tested.) doc/README has a few more notes about this.
Tips:
- Check out what's excluded by default by running
make showexcluded. The default configuration is chosen to be a reasonable balance for beginners and advanced teams. - Take advantage of the hashing when typing in these algorithms. Each
algorithm has a 6 character MD5 hash in the upper right. This hash can be
generated by using
hash.shor the:Hashcommand from the.vimrc. The hashing ignores whitespace and comments.
KACTL uses a relatively terse coding style, with a handful of macros/typedefs defined in the template that help shorten the code. Line width is 63 chars, with tabs for indentation (tab = 2 spaces in the pdf).
Each algorithm contains a header with the author of the code, the date it was added, a description of the algorithm, its testing status, and preferably also source, license and time complexity.
This fork does not keep kactl.pdf to upstream’s 25-page ICPC cap.
Occasionally the generated kactl.pdf is committed to the repo for convenience, but not too often because it makes git operations slower.
KACTL aims for a high level of confidence in algorithm correctness.
Testing is done both on online judges and (for newer algorithms) with stress tests
that compare output to a more naive algorithm for a large amount of randomly generated cases.
These tests live in the stress-tests directory. CI on main runs the full suite (make test); pull requests run only the tests that depend on the changed files (make test-relevant). The CI also verifies that all headers compile (except for an exclude list in doc/scripts/skip_headers) and that the latex compiles.
old-unit-tests contains a couple of broken unit tests, last touched about ten years ago.
As usual for competitive programming, the licensing situation is a bit unclear. Many source files are marked with license (we try to go with CC0), but many also aren't. Presumably good will is to be assumed from other authors, though, and in many cases permission should not be needed since the code is not distributed. To help trace things back, sources and authors are noted in source files.
Everything in stress-tests is implicitly CC0, except reference implementations taken from around the Internet.
Local snippet additions and replacements vs upstream are listed in agents/fork.md.