Hello everyone.
This is ʻatcoderbeginner [jacky](https://twitter.com/jacky_dev) who just turned brown a while ago. I'm using
pypy3 with ʻatcoder
, but when I tried to simplify submission using ʻatcoder-cli`, I was a little lost, so I will share the information.
ʻAtcoder-cli is when you join ʻatcoder
--Test case download --Creating a template --Run test --Submit
It is a tool that lets you do things with cli (command line) instead of a browser. Copy the test case on the browser one by one and open the code test tab. .. .. If you do something like that, you will waste time, so It is a convenient tool that makes those processes easier. There are already many good articles on how to install and explain the tool itself, so please have a look there.
reference
-Command line tool atcoder-cli has been released (Author's blog) -atcoder-cli tutorial (author's blog) -Atcoder beginners should build an environment! (Installation and usage of atcoder-cli, online-judge-tools) (Qiita) -Automate AtCoder directory creation, sample case testing, and submission. atcoder-cli and online-judge-tools (Qiita)
pypy3
using ʻatcoder-cli`If you have read all the above articles, you will know that submission is done with the following command (assuming submission with pypy)
acc s
Then, I think that the output will be like this.
[x] PyPy is available for Python interpreter
[*] chosen language: 4006 (Python (3.8.2))
[!] the problem "https://atcoder.jp/contests/abc170/tasks/abc170_d" is specified to submit, but no samples were downloaded in this directory. this may be mis-operation
[x] sleep(3.00)
Are you sure? Please type "abcd"
This is, in short
--You can use pypy (I don't use it) --Submit in Python (3.8.2) -Is the sample case not downloaded to this directory and you made a mistake? --Wait for 3 seconds --If you want to submit, enter ʻabcd`
Is the message. (You can ignore the third message (whether you made an operation error) unless it is really an operation error.)
As written here, if you execute the submit command normally, it will be submitted as the answer in python
.
To submit this with PyPy
, use the following command.
acc s main.py -- --guess-python-interpreter pypy
The output at this time is
[x] PyPy is available for Python interpreter
[x] both Python2 and Python3 are available for version of Python
[x] use: 3
[*] chosen language: 4047 (PyPy3 (7.3.0))
[!] the problem "https://atcoder.jp/contests/abc170/tasks/abc170_d" is specified to submit, but no samples were downloaded in this directory. this may be mis-operation
[x] sleep(3.00)
Are you sure? Please type "abcd"
Then, when you look at the 4th line, you can see that PyPy3
is properly selected.
If you execute the submission with this, it will be submitted properly with PyPy3
.
For details, see the following issue. How can I use PyPy as default language?
Now I can submit it, but I'm tired of typing this command and I want to submit it more easily.
I use the task runner feature of VScode
to make things easier.
About the task runner function
Please look around.
Simply put, if you describe the task as .vscode/tasks.json
directly under the project directory, it is a function that can be executed easily.
I am making the following tasks.json
.
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "test",
"type": "shell",
"command": "oj",
"args": ["t","-c","'pypy3 main.py'"],
"options": {"cwd": "${fileDirname}"}
},
{
"label": "submit",
"type": "shell",
"command": "acc",
"args": ["s","main.py","--","--guess-python-interpreter","pypy"],
"options": {"cwd": "${fileDirname}"}
},
]
}
In tasks
, the first is the task for test execution and the second is the task for submission.
Common to both,
"options": {"cwd": "${fileDirname}"}
The meaning of the part is that the directory containing the currently open file is specified as the location to execute these commands.
By doing this, you can easily execute the task after opening the command palette.
(Command Palette (⇧⌘P)
)
This will make your life comfortable and your rate will explode! !! !! !! !!
Recommended Posts