Python <= 3.11
-
MacOS
,Linux
,Windows
$ pip install boj-cli
# ~/myproject/.boj/config.yaml
general:
selenium_browser: "chrome" # required - firefox | chrome | edge
default_filetype: "cpp" # optional - default filetype for 'boj add'
editor_command: "nvim -o" # required - code | nvim | ..
workspace:
ongoing_dir: "problems" # optional - ongoing problem directory. default: ""
archive_dir: "archives" # optional - archive directory. default: "archives"
filetype:
py:
language: "python3" # required - language for your submission
main: "main.py" # required - the main file name
run: "python3 $file" # required - the run command
cpp:
language: "c++17"
main: "main.cpp"
source_templates: # optional - these files will be copied into source dir
- "main.cpp"
root_templates: # optional - these files will be copied into root dir
- "compile_flags.txt"
compile: "g++ -std=c++17 $file" # optional - set this option if you use compile language
run: "./a.out"
after: "rm -rf a.out" # optional - command to execute after 'boj run'
# other filetypes ..
filetype.language
์ ๋ค์ด๊ฐ ์ ์๋ ๊ฐ๋ค์ Supported languages๋ฅผ ์ฐธ๊ณ ํด์ฃผ์ธ์.
usage: boj [-h] [-v] {init,add,login,open,random,run,submit,clean,case} ...
positional arguments:
{init,add,login,open,random,run,submit,clean,case}
init initializes BOJ directory
add sets up an environment of the given problem id
login logs in to BOJ
open opens a problem of given id in browser
random queries and opens a random problem in browser
run runs generated testcases
submit submit your solution and trace the realtime statement
clean archives accepted source files
case manages testcases
options:
-h, --help show this help message and exit
-v, --version show version
$ boj init
ํ์ฌ ๊ฒฝ๋ก๋ฅผ BOJ ๋๋ ํ ๋ฆฌ๋ก ์ค์ ํ๊ณ ๋ค์๊ณผ ๊ฐ์ ๋ฆฌ์์ค๋ค์ ์์ฑํฉ๋๋ค.
./.boj
./.boj/config.yaml
./.boj/templates
$ boj login
๋ฐฑ์ค ์จ๋ผ์ธ ์ ์ง์์๋ ๋ก๊ทธ์ธ ์ reCAPTCHA
๋ฅผ ์ฌ์ฉํ๊ณ ์๊ธฐ ๋๋ฌธ์ ๋ก๊ทธ์ธ ๊ณผ์ ์ ์กฐ๊ธ ๋ฒ๊ฑฐ๋ก์ธ ์ ์์ต๋๋ค.
์ ๋ช
๋ น์ด๋ฅผ ์คํํ๋ฉด selenium
๋ธ๋ผ์ฐ์ ๊ฐ ์คํ๋๊ณ , reCAPTCHA
๋ฅผ ํฌํจํ ๋ก๊ทธ์ธ์ ์ํํ๋ฉด ์ธ์
์ ๋ณด๋ฅผ ๋ก์ปฌ ๋๋ ํ ๋ฆฌ $HOME/.boj-cli
์ ์ํธํํด์ ์ ์ฅํฉ๋๋ค.
๋ก๊ทธ์ธ ์ "๋ก๊ทธ์ธ ์ํ ์ ์ง" ์ฒดํฌ ๋ฐ์ค๋ฅผ ๋ฐ๋์ ์ ํํด์ฃผ์ธ์.
$ boj add 1234 -f cpp
Testcases have been created.
$ tree .
โโโ 1234
โย ย โโโ compile_flags.txt
โย ย โโโ main.cpp
โย ย โโโ testcases
โย ย โโโ 1
โย ย โย ย โโโ input.txt
โย ย โย ย โโโ output.txt
โย ย โโโ 2
โย ย โย ย โโโ input.txt
โย ย โย ย โโโ output.txt
โย ย โโโ 3
โย ย โย ย โโโ input.txt
โย ย โย ย โโโ output.txt
โย ย โโโ 4
โย ย โย ย โโโ input.txt
โย ย โย ย โโโ output.txt
โย ย โโโ 5
โย ย โโโ input.txt
โย ย โโโ output.txt
โโโ .boj
โโโ config.yaml
โโโ templates
โโโ compile_flags.txt
โโโ main.cpp
๋ฐฑ์ค ์จ๋ผ์ธ ์ ์ง ๋ฌธ์ ๋ฅผ ํ๊ธฐ์ํ ํด๋๋ฅผ ์์ฑํ๊ณ ๋ค์๊ณผ ๊ฐ์ ์์ ๋ค์ ์ํํฉ๋๋ค.
-
./.boj/templates
ํด๋์ ์์นํ ํ ํ๋ฆฟ ํ์ผ ๋ถ๋ฌ์ค๊ธฐ. - ํฌ๋กค๋ง์ ํ์ฉํด์ ํ ์คํธ๋ก ํ์ฑํ ํ ์คํธ์ผ์ด์ค ํ์ผ ์์ฑ.
--type, -t str: ํ์ผ ํ์
์ ์ง์ ํฉ๋๋ค. (e.g. cpp, ts, rs, py ...)
(์ด ์ต์
์ 'config.general.default_filetype'์ override ํฉ๋๋ค.)
--force, -f: ์ด๋ฏธ ๋ฌธ์ ๊ฐ ์กด์ฌํ๋ ๊ฒฝ์ฐ์๋ ๋ฎ์ด์๋๋ค.
# Outside of problem dir
$ boj run 1234
# Inside of problem dir
$ cd 1234 && boj run
testcases
๊ฒฝ๋ก์ ์๋ ๋ชจ๋ ํ
์คํธ์ผ์ด์ค๋ฅผ ๋น๋๊ธฐ์ ์ผ๋ก ์คํํ๊ณ ์ ๋ต์ ๋น๊ตํฉ๋๋ค.
๋ฌธ์ ํด๋ ์์์ ์คํํ๋ฉด ๋ฌธ์ ๋ฒํธ ์ธ์๋ฅผ ์๋ตํ ์ ์์ต๋๋ค.
--timeout int(sec): ๊ฐ ํ
์คํธ์ผ์ด์ค์ ํ์์์์ ์ค์ ํฉ๋๋ค (default: 10์ด)
# Outside of problem directory
$ boj submit 1234
# Inside of problem directory
$ cd 1234 && boj run
๋ก์ปฌ ์์ค ํ์ผ์ ๋ฐฑ์ค ์จ๋ผ์ธ ์ ์ง์ ์ ์ถํ๊ณ ์ฑ์ ํํฉ์ ์ค์๊ฐ์ผ๋ก ๊ตฌ๋ ํฉ๋๋ค.
๋ฌธ์ ํด๋ ์์์ ์คํํ๋ฉด ๋ฌธ์ ๋ฒํธ ์ธ์๋ฅผ ์๋ตํ ์ ์์ต๋๋ค.
--open [ 'open' | 'close' | 'onlyaccepted' ]: ์ฝ๋ ๊ณต๊ฐ ์ฌ๋ถ๋ฅผ ์ค์ ํฉ๋๋ค. default: 'onlyaccepted'
--timeout int: ์ ์ถ ํํฉ ์น์์ผ์ ํ์์์ ์ค์ (์ด) (default: 10)
$ boj clean
boj submit
๋ช
๋ น์ด ์ํ ๊ฒฐ๊ณผ๋ก accepted๋ฅผ ๋ฐ์ ๋ชจ๋ ๋ฌธ์ ๋ค์ config.workspace.archive_dir
๋ก ์์นด์ด๋ธํ๋๋ค.
์์นด์ด๋ธ ๋๋ ํ์ผ์
yyyymmdd_hhmmss_{filename}
์ ํฌ๋ฉง์ผ๋ก ์ ์ฅ๋ฉ๋๋ค. ๋ง์ง๋ง ์ ์ถ ์ดํ์ ๋ณ๊ฒฝ๋ ์์ค ์ฝ๋์ ๋ํด์๋ ์์นด์ด๋น์ ์ํํ์ง ์์ต๋๋ค.
--origin, -o: ์์นด์ด๋ธ ํ์ผ ํฌ๋ฉง์ ๋ฌด์ํ๊ณ ์๋ณธ ํ์ผ ์ด๋ฆ์ ์ฌ์ฉํ๋ฉฐ, ํ์ผ ์ด๋ฆ์ด ์ด๋ฏธ ์กด์ฌํ๋ฉด ๋ฎ์ด์๋๋ค.
# Outside of problem directory
$ boj open 1234
# Inside of problem directory
$ cd 1234 && boj open
๊ธฐ๋ณธ ๋ธ๋ผ์ฐ์ ์์ ๋ฌธ์ ๋ฒํธ์ ํด๋นํ๋ ํ์ด์ง์ ๋งํฌ๋ก ์ด๋ํฉ๋๋ค.
๋ฌธ์ ํด๋ ์์์ ์คํํ๋ฉด ๋ฌธ์ ๋ฒํธ ์ธ์๋ฅผ ์๋ตํ ์ ์์ต๋๋ค.
$ boj random --tier g1..g5 --tags dp math
solvedac API๋ฅผ ํ์ฉํด์ ๋ฌธ์ ๋ฅผ ๊ฒ์ํ๊ณ , ๊ธฐ๋ณธ ๋ธ๋ผ์ฐ์ ์์ ๋งํฌ๋ก ์ด๋ํฉ๋๋ค.
์ฌ๋ฌ๊ฐ์ tags ์ต์ ์ 'OR' ์กฐ๊ฑด์ผ๋ก ๋์ํฉ๋๋ค.
'๋ด๊ฐ ํ์ง ์์ ๋ฌธ์ ' ๋ง ์ฟผ๋ฆฌ๋ฉ๋๋ค.
--tier, -i: ๋ฌธ์ ํฐ์ด ์ฟผ๋ฆฌ
--tags, -t: ๋ฌธ์ ํ๊ทธ ์ฟผ๋ฆฌ
$ boj case -e 1
$ boj case -n
config.general.editor_command
๊ฐ์ ์ฐธ์กฐํ์ฌ ํ
์คํธ ์ผ์ด์ค ํ์ผ์ ๊ด๋ฆฌํฉ๋๋ค.
--edit $TESTCASE_ID, -e $TESTACSE_ID: ์ฃผ์ด์ง id์ ํด๋นํ๋ ํ
์คํธ์ผ์ด์ค ํ์ผ๋ค์ ํธ์งํฉ๋๋ค.
--new, -n: ์๋ก์ด ํ
์คํธ์ผ์ด์ค๋ฅผ ์์ฑํ๊ณ ํธ์งํฉ๋๋ค. TESTCASE_ID๋ ์๋๋ถ์ฌ ๋ฉ๋๋ค.
c++17
python3
pypy3
c99
c11
text
golfscript
java8
c++98
ruby
c++11
java11
kotlin(jvm)
c++14
swift
java8(openjdk)
c++20
c#
node.js
go
d
rust2018
go(gccgo)
c++17(clang)
java15
d(ldc)
php
rust2015
pascal
lua
perl
f#
visual-basic
objective-c
c99(clang)
c++98(clang)
c++11(clang)
c++14(clang)
objective-c++
c11(clang)
c90
c90(clang)
c2x(clang)
typescript
c++20(clang)
bash
fortran
scheme
awk
c2x
assembly(32bit)
assembly(64bit)
o-caml
whitespace
lolcode
intercal
rhino
cobol
pike
sed
tcl
brainf**k
ada
system-verilog
algol68
befunge
haxe
์ํฌ
bc
free-basic
rust2021
scala