Cargo-BOJ: test and submit solutions to BOJ problems

Related tags

Utilities cargo-boj
Overview

Cargo-BOJ

Test and submit solutions to BOJ (Baekjoon Online Judge) problems.

Defaults are geared towards Rust solutions, but non-Rust usage is supported as well.

Prerequisites

A stable Rust toolchain.

Installation

cargo install cargo-boj

Usage

The default usage of test and submit commands assume that cargo boj is being run at the crate root with either src/main.rs or src/bin/main.rs being the solution file.

Login

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.

$ 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.

or:

$ cargo boj login --bojautologin=3b1adXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX --onlinejudge=n00lXXXXXXXXXXXXXXXXXXXXXX

Test

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 sol_1000.rs
$ cargo boj test 1000 --bin=sol_1000
# Test 1000.py
$ cargo boj test 1000 --cmd='python 1000.py'

Submit

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
You might also like...
Cargo subcommand for optimizing binaries with PGO and BOLT.
Cargo subcommand for optimizing binaries with PGO and BOLT.

cargo-pgo Cargo subcommand that makes it easier to use PGO and BOLT to optimize Rust binaries. Installation $ cargo install cargo-pgo You will also ne

Load and resolve Cargo configuration.

cargo-config2 Load and resolve Cargo configuration. This library is intended to accurately emulate the actual behavior of Cargo configuration, for exa

cargo, make me a project
cargo, make me a project

cargo-generate cargo, make me a project cargo-generate is a developer tool to help you get up and running quickly with a new Rust project by leveragin

Render cargo dependency tree in online

Cargo Tree Online Check out rendered page Render cargo dependency tree in online. Usage trunk serve Copy and paste the content of Cargo.lock file to

Generate a THIRDPARTY file with all licenses in a cargo project.

cargo-bundle-licenses Bundle all third-party licenses into a single file. NOTE This tools is not a lawyer and no guarantee of correctness can be made

Rust+Cargo lightweight hello world with the most minimum binary size possible.

Lightweight Cargo Hello World Rust+Cargo lightweight hello world with the most minimum binary size possible. requirements 1: Rustup (Rustc, Cargo) Ins

Plugin to request a relaunch when uploading a Skyline plugin through cargo skyline

restart-plugin A skyline plugin for allowing cargo-skyline (or other tools) to restart your game without you having to touch your controller. Install

Convenience wrapper for cargo buildscript input/output

A convenience wrapper for cargo buildscript input/output. Why? The cargo buildscript API is (necessarily) stringly-typed.

A cargo subcommand that displays the assembly generated for Rust source code

cargo-show-asm A cargo subcommand that displays the assembly generated for Rust source code.

Owner
null
cargo-lambda a Cargo subcommand to help you work with AWS Lambda

cargo-lambda cargo-lambda is a Cargo subcommand to help you work with AWS Lambda. This subcommand compiles AWS Lambda functions natively and produces

David Calavera 184 Jan 5, 2023
cargo-lambda is a Cargo subcommand to help you work with AWS Lambda.

cargo-lambda cargo-lambda is a Cargo subcommand to help you work with AWS Lambda. The new subcommand creates a basic Rust package from a well defined

null 184 Jan 5, 2023
A cargo subcommand that extends cargo's capabilities when it comes to code generation.

cargo-px Cargo Power eXtensions Check out the announcement post to learn more about cargo-px and the problems it solves with respect to code generatio

Luca Palmieri 33 May 7, 2023
Minimal, flexible framework for implementing solutions to Advent of Code in Rust

This is advent_of_code_traits, a minimal, flexible framework for implementing solutions to Advent of Code in Rust.

David 8 Apr 17, 2022
My solutions to the Advent of Code 2020.

AdventofCode2021 My solutions to the advent of code event 2021. For this edition I chose to solve the puzzles using Rust ?? . Day Name Link Solution 1

Lars Leijten 1 Dec 22, 2021
Code to brute-force Wordle solutions

Wordle solver The idea of this is to find the optimal solution to Wordle puzzles. The current implementation, for each guess, works out the worst case

Simon Frankau 1 Jan 9, 2022
Wait Service is a pure rust program to test and wait on the availability of a service.

Wait Service Wait Service is a pure rust program to test and wait on the availability of a service.

Magic Len (Ron Li) 3 Jan 18, 2022
Watches changes in a rust project, runs test and shows friendly notification

Cargo testify Automatically runs tests on your Rust project and notifies about the result. Install Install prerequisites (for Debian/Ubuntu): apt-get

Sergey Potapov 77 May 16, 2022
This is a test to port C++'s ymfm and Rust's vgmplay to ESP32(Xtensa).

m5stack-chipstream This is a test to port C++'s ymfm and Rust's vgmplay to ESP32(Xtensa). Still slow and impractical, depending on the sound chip you

hiromasa 4 Feb 26, 2023
Transmute - a binary that works alone or in coordination with coverage formatter to report test quality

Transmute is a binary that works alone or in coordination with coverage formatter to report test quality. It will change your code and make the tests fail. If don't, we will raise it for you.

Victor Antoniazzi 5 Nov 17, 2022