A guy with a lot of useful things to do when doing AtCoder in Python

Overview

atcoder_python_env

Python で AtCoder をやるときに便利な諸々を用意したやつ

必要なモジュールのインストール

online-judge-toolsatcoder-cli を使います

$ pip3 install -r requirements.txt
$ npm install -g atcoder-cli

コンテスト用フォルダの作成

例えば下記コマンドで abc/abc100 フォルダが作成されます

$ python3 build_contest_env.py abc/abc100

階層は以下のようになります

.
├── abc
│   └── abc100
│       ├── a.py
│       ├── b.py
│       ├── c.py
│       ├── d.py
│       ├── e.py
│       ├── f.py
│       ├── g.py
│       ├── h.py
│       ├── judge.py
│       ├── setup.py
│       └── submit.py
├── temp
│   ├── judge.py
│   ├── setup.py
│   ├── submit.py
│   └── temp.py
├── .gitignore
├── README.md
├── build_contest_env.py
└── requirements.txt

a.py ~ h.py がそれぞれの問題を解くためのファイルで、 temp/temp.py の内容をコピーしたものです。なので自分のテンプレファイルを使いたい場合は temp/temp.py を変更してください

なお、フォルダ名は自由で大丈夫ですが、セットアップの際にフォルダのパスの末尾をデフォルトのコンテストIDとして認識するように設定してあるので末尾はコンテストIDにしておくと便利です

オプションがいくつかあるので詳しくは下記コマンドによりヘルプを参照してください

$ python3 build_contest_env.py -h

セットアップ

セットアップでは全問題のサンプルケースのダウンロードと自動テスト・自動提出のための設定を行います

自動テストと自動提出を行う前に必ず実行してください

上記で作成したディレクトリに移動します

$ cd abc/abc100

下記コマンドによりセットアップを行います

$ python3 setup.py -c abc100

-c オプションによりコンテストIDを指定します

なおデフォルトではカレントディレクトリの末尾をコンテストIDと認識するようになっているので、今回の例では下記コマンドでも大丈夫です

$ python3 setup.py

初回実行時は自動テスト・自動提出のために online-judge-tools と atcoder-cli のそれぞれから AtCoder にログインするため2回続けてログインを要求します

2回目の実行以降はログインなしで実行可能です

自動テスト

abc/abc100 ディレクトリにおいて、例えば下記コマンドにより A 問題のサンプルケースを自動でテストします

$ python3 judge.py a

-s オプションをつけて実行するとサンプルが全て一致していたら自動で提出も行います

$ python3 judge.py a -s

他にもオプションがいくつかあるので詳しくは下記コマンドによりヘルプを参照してください

$ python3 judge.py -h

自動提出

abc/abc100 ディレクトリにおいて、例えば下記コマンドにより A 問題に自動で提出します

$ python3 submit.py a

-l オプションにより pypy で提出するか python で提出するか選べます、デフォルトは pypy です

$ python3 submit.py a -l python

詳しくは下記コマンドによりヘルプを参照してください

$ python3 submit.py -h
You might also like...
For when you really need to rank things

Comparisonator For when you really need to rank things. Do you know that feeling when there's this urge deep within you that tells you to compare thin

A sandpit for textual related things

A sandpit repo for testing textual related things.

A price calculator for multiple things
A price calculator for multiple things

Price Calculator A price calculator for multiple things Example I have 0.0567kg diamond. The price of diamond in kg is: $4500. Then it says: The price

Mines all the moneys and stuff and things.

NFT Miner NFT Miner - Version 1.1.0 - Quick Fix Since the whole NFT thing started booming on Twitter it's been hard not to see one of those ugly ass m

ToDo - A simple bot to keep track of things you need to do

ToDo A simple bot to keep track of things you need to do. Installation You will

Additional useful operations for Python

Pyteal Extensions Additional useful operations for Python Available Operations MulDiv64: calculate m1*m2/d with no overflow on multiplication (TEAL 3+

my own python useful functions

PythonToolKit Motivation This Repo should help save time for data scientists' daily work regarding the Time Series regression task by providing functi

Some Python scripts that fx(hash) users might find useful.

fx_hash_utils Some Python scripts that fx(hash) users might find useful. get_images This script downloads all the static images of the tokens generate

A code base for python programs the goal is to integrate all the useful and essential functions
A code base for python programs the goal is to integrate all the useful and essential functions

Base Dev EN This GitHub will be available in French and English FR Ce GitHub sera disponible en français et en anglais Author License Screen EN 🇬🇧 D

Owner
null
This repository contains a lot of short scripting programs implemented both in Python (Flask) and TypeScript (NodeJS).

fast-scripts This repository contains a lot of short scripting programs implemented both in Python (Flask) and TypeScript (NodeJS). In python These wi

Nahum Maurice 3 Dec 10, 2022
1cak - An Indonesian web that provide lot of fun.

An unofficial API of 1cak.com 1cak - An Indonesian web that provide lot of fun. Endpoint Lol -> 10 Recent stored posts on database Example: https://on

Dicky Mulia Fiqri 5 Sep 27, 2022
Let's make a lot of random function from Scracth...

Pseudo-Random On a whim I asked myself the question about how randomness is integrated into an algorithm? So I started the adventure by trying to code

Yacine 2 Jan 19, 2022
Calculatrix is a project where I'll create plenty of calculators in a lot of differents languages

Calculatrix What is Calculatrix ? Calculatrix is a project where I'll create plenty of calculators in a lot of differents languages. I know this sound

null 1 Jun 14, 2022
Get information about what a Python frame is currently doing, particularly the AST node being executed

executing This mini-package lets you get information about what a frame is currently doing, particularly the AST node being executed. Usage Getting th

Alex Hall 211 Jan 1, 2023
🛠️ Learn a technology X by doing a project - Search engine of project-based learning

Learn X by doing Y ??️ Learn a technology X by doing a project Y Website You can contribute by adding projects to the CSV file.

William 408 Dec 20, 2022
Just some mtk tool for exploitation, reading/writing flash and doing crazy stuff

Just some mtk tool for exploitation, reading/writing flash and doing crazy stuff. For linux, a patched kernel is needed (see Setup folder) (except for read/write flash). For windows, you need to install zadig driver and replace pid 0003 / pid 2000 driver.

Bjoern Kerler 1.1k Dec 31, 2022
A example project's description is a high-level overview of why you’re doing a project.

A example project's description is a high-level overview of why you’re doing a project.

Nikita Matyukhin 12 Mar 23, 2022
Python Common things by Problem Fighter Library, (Exception, Debug Log, etc.)

In the name of God, the Most Gracious, the Most Merciful. PF-PY-Common Documentation Install and update using pip: pip install -U xxxx Please find the

Problem Fighter 3 Jan 15, 2022
A curated list of awesome things related to Pydantic! 🌪️

Awesome Pydantic A curated list of awesome things related to Pydantic. These packages have not been vetted or approved by the pydantic team. Feel free

Marcelo Trylesinski 186 Jan 5, 2023