エンジニアのブログ

最近クラウドを触りはじめたエンジニアのブログ

AtCoder用のツール利用方法

online-judge-tools、atcoder-cli のインストール

$ pip3 install online-judge-tools
$ yarn global add atcoder-cli

online-judge-toolsとの連携確認

$ acc check-oj
> online-judge-tools is available. found at:

online-judge-tools、atcoder-cli へのログイン

$ acc login
> Username: ***
> Login: ***

$ oj login https://atcoder.jp/
> Username: ***
> Login: ***

入出力サンプルのインストール

URLが「https://atcoder.jp/contests/practice/」の場合

acc new practice
or
acc add practive

入出力サンプルの実行(javascriptの場合)

$ pwd
/Users/xxxx/atcoder/practice/a
$ touch code.js
# ファイルを編集する

$ oj t -c "node ./code.js" -d ./tests/
[INFO] online-judge-tools 11.5.1 (+ online-judge-api-client 10.10.1)
[INFO] 2 cases found

[INFO] sample-1
[INFO] time: 0.404934 sec
[SUCCESS] AC

[INFO] sample-2
[INFO] time: 0.236824 sec
[SUCCESS] AC

[INFO] slowest: 0.404934 sec  (for sample-1)
[SUCCESS] test success: 2 cases

参考

qiita.com tatamo.81.la