Using Kattis’ Client on Linux

Create a Kattis Account

  1. Create an account on open.kattis.com. Choose Log in with e-mail, then choose Sign up for a Kattis account. Use your Bridgewater College email address when creating an account.

Getting the Kattis Client and Config File

  1. Log into open.kattis.com.
  2. Choose the Help tab, then choose the How to submit link located near the bottom of the page.
  3. Scroll down to the section titled Downloading a configuration file and client and download your personal configuration file and the Kattis client.
  4. Open terminal or GitBash and change the working directory to the location of the files you downloaded (perhaps in your download directory). Then use the following command to copy the files to your home directory on your VM.
scp -i <path to keypair file> <file name to transfer> ec2-user@<ip address>:<file name to transfer>

Note that when typing the above command you need to replace <path to keypair file>, <file name to transfer>, and <ip address> with appropriate information.

Setting Up Submit.py

  1. SSH into your VM.
  2. Run chmod 700 submit.py.
  3. Create a subdirectory in your home directory named bin and move submit.py into bin.
  4. Verify that $HOME/bin is in your $PATH. If not, add it.
  5. Run sudo pip install configparser.
  6. Make two edits to submit.py.
    1. Remove the 3 from the first line. The first line should read #!/usr/bin/env python.
    2. Add a line that reads import configparser.

Setting up .kattisrc

  1. Rename the kattis config file (e.g. kattisrc.txt) to .kattisrc.

Testing the Script

  1. Navigate to https://open.kattis.com/problems/hello with a browser to view the hello problem.
  2. Write a program on your VM that solves the hello problem with a class named Hello in a file named Hello.java.
  3. Submit your program to Kattis using the following command: submit.py -p hello -l Java -m Hello Hello.java
  4. Navigate to open.kattis.com with a browser and click on your name in the upper right corner to see if your solution was accepted.

About the author