Book Code for Competitive Programming
翻译准备中
教育C++ · PythonGitHub @ecnerwala自行安装运营者未确认
试用过了吗? 点一下就好,无需登录。
尚未检测到更新。GitHub 发布版本后会显示在这里。
个人 GitHub 账号下公开仓库的所有者可以登录并验证所有权,自行管理介绍,无需管理员批准。
登录并生成验证文件,在 30 分钟内将其提交到此仓库的默认分支。其他分支或分叉仓库中的文件无效。然后在下方检查文件,即可无需管理员批准直接管理项目。请保留文件以维持管理权限。
如需登录,将前往登录页面。登录后请回到此处,再次点击所选的验证按钮。
安装型项目无需部署域名也可验证。个人仓库可通过 GitHub 登录验证,组织仓库可使用上方的仓库验证文件。
制作者的介绍仅有上面的一句话。 更多详情请阅读仓库 README。 仓库 README ↗
正在加载完整 README。
查看完整 README ↗This is my library of reference code for competitive programming. The goal is to write generic, fast, and clean algorithm implementations for use in contests like CodeForces or ICPC.
The library lives in src/ as standalone headers organized by area
(#include "fft/series.hpp", #include "ds/seg_tree.hpp", compiled with
-I src), all inside namespace wala. The library requires C++23 (the whole toolchain
builds with -std=c++23, e.g. g++ >= 13). Browsable source, verification
results, and coverage are hosted at https://ecnerwala.github.io/cp-book/.
cmake -B build && cmake --build build
ctest --test-dir build # or ./build/tests
Unfortunately, some files (e.g. full power series with all fft engines) are too long to fit in CF's submission limit, so we need to bundle/minify them for submission.
scripts/bundle.py verify/fft/convolution_mod.test.cpp > submission.cpp
scripts/bundle.py fft/series.hpp ds/seg_tree.hpp # bundle headers together
scripts/bundle.py --minify fft/series.hpp # compiler-directed minification
scripts/bundle.py --all # pregenerate all headers
The script runs in the repo's uv project
(pyproject.toml / uv.lock, which pin competitive-verifier). To run it
offline, first populate the environment with
uv sync
Then, you can run
UV_OFFLINE=1 scripts/bundle.py ...
uv run --offline scripts/bundle.py ...
Bump the pinned competitive-verifier by editing rev in pyproject.toml
and running
uv lock --upgrade-package competitive-verifier
verify/ holds Library Checker solutions,
verified in CI with
competitive-verifier.
# Run verification locally
uv run competitive-verifier oj-resolve --include src verify --exclude third_party \
--config .competitive-verifier/config.toml > verify_files.json
uv run competitive-verifier verify --verify-json verify_files.json
contest/ holds standalone tooling for contests: a problem-directory
template (Makefile with sanitizers and precompiled headers), a layered
.template instantiator (make_prob.py), and a
Competitive Companion
listener (download_prob.py). See contest/README.md.
Contest programs are standalone; vendor book code in as needed (e.g. with
scripts/bundle.py).
All code is written by me and CC0 licensed unless otherwise noted in the file. Inspiration is largely drawn from KACTL and other references.