AtCoder Challenge Environment Construction (Java 8)

Introduction

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.

motivation

――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)

Target environment

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.

1. Java installation

AtCoder can use OpenJDK 1.7.0 or OpenJDK 1.8.0. I have Java SE 8 installed in my local environment.

  1. Download the installer from Java SE Downloads
  2. Install according to the installer.
  3. It is recommended that people who have changed the installation location and those who have not changed it adjust the environment variables for version control.
    JAVA_HOME: [The location where Java is installed. Default: C: \ Program Files \ Java \ jdk1.8.0_xxx]
    Add to PATH:% JAVA_HOME% \ bin

2. Install VS Code

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.

  1. WSL You can find some by searching for "WSL" in the Microsoft Store. If you don't know which one to put in, Ubuntu 18.04 should be fine. (There are many articles) Whether to put Python3 / Node.js in Windows or WSL after that The content of the reference page may be different, so it is better to decide here.

4. Python3 / online-judge-tools and Node.js / atcoder-cli

The page of atcoder-cli gently describes the introduction of these 4 points, so install it according to it. I will.

5. A device that simplifies submission in Java

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

Summary

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.

Jabashi: Why did you choose Windows over WSL?

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

AtCoder Challenge Environment Construction (Java 8)
[Java] Environment construction
Java environment construction
java development environment construction
JavaFX environment construction in Java 13
[Java & SpringBoot] Environment Construction for Mac
Java runtime environment construction method (Tomcat @ Linux)
[Processing x Java] Construction of development environment
Java development environment construction memo on Mac
Java development environment
Play Framework 2.6 (Java) environment construction in Eclipse
Spring Boot + Docker Java development environment construction
[Spring] Environment construction
Docker environment construction
Minimal Java environment construction and Hello World
Road to Java Engineer Part1 Introduction & Environment Construction
JAVA + STS (Spring Tool Suite) environment construction procedure
[Notepad ++] C language / Java compilation & execution environment construction
Penronse environment construction [Windows]
[Environment construction] Eclipse installation
[Summary] Java environment preparation
Rails Docker environment construction
Circle CI environment construction
[LeJOS] Let's program mindstorm-EV3 in Java [Environment construction part 2]
Java development environment construction on Mac-JDK Install (2020 preservation version)
[Mac] VS Code development environment construction (Java, Gradle, Node.js)
[Java] Environment construction procedure for developing struts 1.3 with Eclipse
[Environment construction] Build a Java development environment with VS Code!
Java + Spring development environment construction with VirtualBox + Ubuntu (Xfce4)
Rails6 development environment construction [Mac]
[Spring Boot] Environment construction (macOS)
Rails engineer environment construction ruby2.7.1
EC-CUBE4 environment construction (local edition)
[LeJOS] Let's program mindstorm-EV3 in Java [Environment construction first part]
I tried node-jt400 (Environment construction)
Web application development environment construction in Java (for inexperienced people)
Rails environment construction Rails5.2.1 ruby2.5.1 Catalina
MySQL 5.7 (Docker) environment construction memo
Introduction to Metabase ~ Environment Construction ~
Java web application development environment construction with VS Code (struts2)
Java development environment (Mac, Eclipse)
Redmine (Docker) environment construction memo
[Docker] Rails 5.2 environment construction with docker
Offline environment construction Ruby edition
Docker × Spring Boot environment construction
[Super easy] Ruby environment construction
[Rails / MySQL] Mac environment construction
[Docker] postgres, pgadmin4 environment construction
Create a Java and JavaScript team development environment (gradle environment construction)
Laravel environment construction (Ubuntu 18.04 LTS)
React environment construction with Docker
Offline environment construction CentOS edition
[Java development environment construction] Install OpenJDK 11 (Java 11) on macOS with Homebrew.
[ev3 × Java] leJOS development environment construction (Eclipse on Mac OSX / bluetooth)
Rails + MySQL environment construction with Docker
Solve AtCoder Beginner Contest 151 in java
[Windows] WSL2 + Ubuntu + Node.js environment construction
Node.js environment construction with Docker Compose
[Eclipse Java] Development environment setting memo
◆ Spring Boot + gradle environment construction memo
Execution environment test after Java installation