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.