Here are two CLI tools to help you solve AtCoder comfortably. The environment used in this entry is Windows 10, Python 3. Of course, it also supports other OS and languages.
Contest ID/ ├ a/ │ └ main.py │ └ test/ │ └ sample-1.in │ └ sample-1.out │ └ sample-2.in │ └ ... ├ b/ │ └ main.py │ └ test/ │ └ ... └ ...
Atcoder-cli runs on node.js and online-judge-tools runs on Python, so you need to install them. If you haven't installed it yet, we recommend installing it with Chocolatey (Homebrew for Windows, Mac). Future updates will be much easier.
After installing Chocolatey, execute the following command and it's OK.
install.ps1
cinst nodejs.install -y
cinst python -y
Refer to the tutorial below and
To complete.
You need to log in to AtCoder with both atcoder-cli and online-judge-tools.
Let's change the settings to make atcoder-cli easier to use. There is no setting in online-judge-tools.
[Introduction to online \ -judge \ -tools \ (Japanese ) # Non-existent features — online \ -judge \ -tools documentation](https://online-judge-tools.readthedocs.io/en/master/introduction .ja.html # id7)
Once you have a template set up, you can:
Set the template file according to "Template settings" in the tutorial.
I have the following settings.
├ Config/ │ └ python/ │ └ main.py │ └ template.json │ └ config.json │ └ session.json
template.json
{
"task": {
"program": [
"main.py"
],
"submit": "main.py"
}
}
main.py
#!/usr/bin/env python3
def main():
N = map(int, open(0).read().split())
main()
#! / usr / bin / env python3
is Shebang.
AtCoder allows you to choose between Python2 and Python3 as the Python execution environment. Shebang is used to explicitly specify that Python3 is used. If you forget this, you will get an error that you cannot narrow down the execution environment to one when submitting.
ʻOpen (0) .read (). split ()` is a read of console input.
You can see the current global settings with ʻacc config`. The default is as follows.
config.sh
$ acc config
oj-path: C:/Python38/Scripts/oj.exe
default-contest-dirname-format: {ContestID}
default-task-dirname-format: {tasklabel}
default-test-dirname-format: tests
default-task-choice: inquire
default-template:
I will change this.
.sh
$ acc config default-test-dirname-format test
Rename the test directory to match online-judge-tools. This allows online-judge-tools to recognize the test directory and allow automated testing of sample cases.
.sh
$ acc config default-task-choice all
When you run ʻacc new {Contest Id} , you set the selection method for problems that create directories. The default ʻinquire
will force you to manually select the question each time.
I want to create all the directories at once, so I set it to ʻall`.
.shell
$ acc config default-template python
Specify the template you want to use by default. I'm using python, but let's specify the most frequently used template created in "Template settings".
This completes the installation of atcoder-cli and online-judge-tools, and you can use it like the video at the beginning. Let's enjoy AtCoder comfortably!