Submitting a Solution Using the Kattis Submit Script

If you are developing software on cs.bridgewater.edu, you can use the Kattis script, named kattis.py, to submit a solution.  It’s already installed on the machine in a directory that is on everyone’s path.  All you need to do is upload your personal configuration file into your home directory.

Uploading Your Personal Configuration File

Log into Kattis and download your personal configuration file onto your local machine by going to https://bridgewater.kattis.com/download/kattisrc.  Be sure to remember where you saved the file.

Then, using a SFTP client like FileZilla, copy the file from your local machine to your home directory on cs.bridgewater.edu.

Once the file is on cs.bridgewater.edu close your SFTP client and log into cs.bridgewater.edu with your SSH client (e.g. Putty).  Once logged on, change the name of the configuration file to “.kattisrc” using the linux mv command.

mv old-file-name .kattisrc

Your personal configuration file contains a private token.  You must not share this with anyone.  Your home directories have permissions set to 700 which means that you have read, write and execute permissions on your directory and everyone else has no rights what-so-ever.  I insist you keep it that way.

Submitting Your Kattis Solutions

Now you’re ready to use the submit script.  In order to use the script you need to

  1. Be in the directory that contains the source code that you want to submit.
  2. Know the Kattis problem identifier for the problem you are working on.
  3. Know which file your main() function is in.

The Kattis problem id can be found in the upper right corner of the problem’s Kattis web page as shown below.

When you’re ready to submit, simply type the following

kattis.py -p problem-id -m class-name -l Java files

where problem-id is the Kattis problem identifier and class-name is the name of the class that contains your main() function and files is a space separated list of your source code files.

For example, to hand in the problem named different we might enter the following:

kattis.py -p different -m Different -l Java Different.java

After you enter the submit command, you should see a prompt similar to the one below.

Problem: different
Language: Java
Files: Different.java
Mainclass: Different
Submit(y/N)?

If all of the information is correct, type a lower case y and hit ‘Enter’.  You should see a confirmation like the following.

Submission received. Submission ID: 1247718.

Within 1 minute of your submission, you should receive an email with the results.

© 2017, Eric. All rights reserved.