|0.3.3||May 11, 2023|
|0.3.2||May 11, 2023|
|0.3.0||Apr 8, 2023|
|0.2.0||Mar 31, 2023|
|0.1.0||Mar 23, 2023|
#220 in Cargo plugins
100 downloads per month
Test and submit solutions to BOJ (Baekjoon Online Judge) problems.
Defaults are geared towards Rust solutions, but non-Rust usage is supported as well.
A stable Rust toolchain.
cargo install cargo-boj
You can use the same command to update to the latest version.
The default usage of
submit commands assume that
cargo boj is being run at the crate root with
src/bin/main.rs being the solution file.
src/main.rs takes precedence if both are present.
Logging in to BOJ with ID and password cannot be automated because it is protected with reCaptcha.
So, the users are expected to log in on their own browser first, and then copy relevant cookies into
$ cargo boj login First log in to www.acmicpc.net on your browser with auto-login enabled. Then copy and paste two cookies for www.acmicpc.net from your browser. bojautologin: 3b1adXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX OnlineJudge: n00lXXXXXXXXXXXXXXXXXXXXXX Cookies set.
$ cargo boj login --bojautologin=3b1adXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX --onlinejudge=n00lXXXXXXXXXXXXXXXXXXXXXX
Tests your code against example test cases for the given problem.
- Test cases are fetched once and then cached.
- A colored diff is provided when a test fails with Wrong Answer.
# Test main.rs against example test cases of problem 1000 $ cargo boj test 1000 # Test src/bin/sol_1000.rs $ cargo boj test 1000 --bin=sol_1000 # Test 1000.py $ cargo boj test 1000 --cmd='python 1000.py'
Submits your code to BOJ using the credentials provided with
cargo boj login.
The default language is
Rust 2021 (language ID 113). To submit solutions in other languages,
refer to BOJ Help: language info.
# Submit main.rs as Rust 2021 solution to problem 1000. Code open setting follows account preference $ cargo boj submit 1000 # Submit sol_1000.rs as Rust 2018 solution, with code closed $ cargo boj submit 1000 --path=src/bin/sol_1000.rs --lang=94 --code-open=n
Using within BOJ contest
When you open a problem in a contest, the address will be like
Then the problem ID for this problem is
You can use this ID in place of "problem ID" when using
cargo boj test and
cargo boj submit.
cargo boj testtrying to run incorrect executable name when the file to run is
cargo boj testfailing to find the built executable on Windows
- Add support for BOJ contests