I was able to build a challenging environment for AtCoder to the point where I was satisfied. I don't know if it will be useful to everyone, but I have compiled it in an article to share information.
――I felt that it would be better to learn Java than the company's climate.
--Start Java learning in earnest from 3/1
--Solve the problem with CodingBat because you get used to it rather than learning
--Since I was getting tired of the problem, I reached AtCoder from collecting information.
--First participation in the Panasonic Programming Contest 2020 held on Saturday, March 14, 2020.
I couldn't adjust the error of the square root and suffered a devastating defeat with only A and B questions.
――After that, I worked hard on the exercises of past problems, but unlike the Coding Bat I used at the beginning,
I gradually felt that it was troublesome to easily and submit test cases.
(WA due to problem selection mistakes and language selection mistakes many times ...)
――Build an environment so that you can collect various information and operate it locally.
Now I can focus on the problem.
――Is there anyone who has the same troubles? I thought. (Now here)
I built it on Windows 10. I was able to build it with WSL, but I think it doesn't matter which one because it is in a good condition. After construction, it will be in the following state.
AtCoder can use OpenJDK 1.7.0 or OpenJDK 1.8.0. I have Java SE 8 installed in my local environment.
abridgement. I'll link my article. Use Visual Studio Code on an offline PC I think the Java Extension Pack is all you need for extensions. If you are using Eclipse or another editor, you do not need to include it.
The page of atcoder-cli gently describes the introduction of these 4 points, so install it according to it. I will.
The following is simplified by introducing atcoder-cli / online-judge-tools above.
--Create a folder according to the problem (contestID / A to F folders) --Layout of templated files --Get sample test case --Sample test judgment
Something is missing. Yes, it's a submission.
I don't know if the setting method is insufficient or if it is not supported due to lack of functions now, but when I submit the Java source from atcoder-cli, I get angry with "Select version!".
In online-judge-tools, you can specify the language, so you can execute it, but here you have to enter the URL every time.
... The browser is easier.
So I made a batch to cover it.
I borrowed the atcoder-cli submission operation ʻacc s and created it with ʻacc s
(no whitespace).
(WSL can handle it with alias or bash.)
accs.bat
@echo off
setlocal enabledelayedexpansion
rem ---Main sequence
setlocal
Get rem command execution position
FOR /F %%i in ('cd') do set pwd=%%i
Move to the rem command execution position
cd %pwd%
rem Get contest ID and task ID from local path
rem example) C:\AtCoder\abc123\a
set contest_id=%pwd:~-8,6%
set task_id=%pwd:~-1%
rem Submit call with contest ID and task ID as parameters
call :Submit %contest_id% %task_id%
endlocal
exit /b
rem ---Submission sequence
:Submit
rem online-judge-Submit by specifying the language with tools
Create URL from rem parameter
oj submit -l Java8 --no-guess https://atcoder.jp/contests/%1/tasks/%1_%2 Main.java
exit /b
I can submit it safely, so I can do it locally. After confirming the problem with the browser, you can now submit it with VS Code biting. Once you've built your environment, you can't go back to what you were coding in your browser's code test page.
It's a slapstick, but the reason I chose Windows when choosing Windows / WSL
Since the test case files of past problems have different names, the name is changed frequently,
Windows is used for the convenience of the rename command.
Example 1) I want to change 01.txt, 02.txt, ... 20.txt in the in folder to 01.in, 02.in, ... 20.in
Windows: ren *.txt *.in
Linux: rename txt in *.txt
Example 2) I want to change 01, 02, ... 20 in the in folder to 01.in, 02.in, ... 20.in
Windows: ren * *.in
Linux: rename 's/$/.in/' *
I'm working on Windows because Windows commands are more intuitive to me.
Recommended Posts