✓ Uses Rust 2018 edition
|0.2.2||Nov 21, 2019|
|0.2.1||Oct 17, 2019|
|0.2.0||Oct 17, 2019|
|0.1.0||Oct 15, 2019|
#269 in Command line utilities
52 downloads per month
Warning: This is an unofficial client and may break without notice. If it does, please leave an issue.
- Minimize typing by using code templates.
- Automatically download problem samples and test your solution against them.
- Submit and get updates on your solutions without leaving the terminal.
This tool can easily be installed using Cargo, the Rust package manager.
cargo install kattis
It is normal for installation to take a minute. Meanwhile, you can prepare your configuration.
Our first order of business is to find the problem's id:
aaah. This will be
used by the client to download all the problem's samples and setup a new test
kattis new --problem aaah --template rust
By default this command creates a new directory called
aaah in which we will
find our template (in this case the template called
At this point we would write our solution, and when we believe we have a working solution we can test our hypothesis by running:
cd aaah kattis test
This will run the build commands specified in the
kattis.yml followed by the
run commands, once for every sample. If our solution was correct we should see
the following output:
Running test case: aaah.1 Correct Running test case: aaah.2 Correct
If our solution was wrong we would instead see something like (actual output is colorized for readability):
Running test case: aaah.1 Correct Running test case: aaah.2 Wrong Answer Input: aaah ah Found: uh oh Expected: go
Testing your code before submitting will not only make debugging easier, but will also reduce the possibility of you getting a test case wrong. This is especially important in a competition where a wrong answer includes a penalty.
When you are confident that your solution is correct you can easily submit your solution by running:
It will prompt you with a short summary of what will be submitted along with a
confirmation prompt. If you answer
y your submission will be sent and you
should see the status of your submission get periodically updated:
Language: Rust Files: - ./main.rs Main Class: Proceed with the submission? (y/N) y Submission ID: 4253057 Compiling... Running... Test Case 1/52: Accepted Test Case 2/52: Accepted Test Case 3/52: Accepted Test Case 4/52: Accepted ... Test Case 42/52: Accepted ... Test Case 49/52: Accepted Test Case 50/52: Accepted Test Case 51/52: Accepted Test Case 52/52: Accepted Submission Status: Accepted Time: 17:47:24 CPU: 0.00 s
As you would expect, if something has gone terribly wrong you will find out ASAP:
Language: Rust Files: - ./main.rs Main Class: Proceed with the submission? (y/N) y Submission ID: 4253066 Compiling... Compiling... Test Case 1/52: Accepted Test Case 2/52: Accepted Test Case 3/52: Accepted Test Case 4/52: Accepted Test Case 5/52: Wrong Answer Submission Status: Wrong Answer Time: 17:53:36 CPU: 0.00 s
By default kattis will search for your configuration files in your user's configuration directory:
|Linux||$XDG_CONFIG_HOME/kattis or $HOME/.config/kattis||/home/alice/.config/kattis|
You can override the default configuration directory by setting the
KATTIS_CONFIG_HOME environment variable.
Inside the configuration directory you can create a global configuration file
kattis-global.yml. You may print the path to this file by running
kattis config show
In order to make submissions from the command line you will need to download
the appropriate credentials. These can be found
here. If you want to use this
client on any other domain than open.kattis.com
you will find credentials at
<kattis> is the domain, eg.
Unlike the official submission CLI this client does not expect credentials to be
stored in your home directory. Instead they are stored the
inside your configuration directory.
You may name the file containing the credentials whatever you want. Later, such when as when making a new submission, you can use this name to tell the client to submit to a different Kattis domain. This can, among other times, be useful during competitions.
By default the client will search for credentials with the name
open.kattis.com. This behaviour can be overriden by changing the
environment variable or with a command line flag.
A template is basically a folder containing a barebones solution with all boilerplate code already typed out. They can save you a lot of time during competitions (when allowed) as you can spend more time on the problem at hand and less typing code.
Templates are stored as seperate directories in the
templates folder inside
the configuration directory. It is simple to create a new template:
kattis template new <name>
This will create a new template called
<name> in the appropriate directory and
create a default
kattis.yml configuration file.
By default you will have to provide the client with the name of the template you
wish to use with a flag. This behaviour can be overriden by changing the
default_template property in either the global configuration file
In this YAML file you may configure how the template is built, which files are submitted, and so on:
||The directory in which samples will be stored|
||A list of files that should be submitted to the judge|
||The language the solution is written in|
||Optional. Specify the main class|
||A list of commands to execute in order to build the solution|
||The command to run in order to run the solution|
Note that for interpreted languages such as Python there's no need for a build step, as such you may leave the
When a template is used to create a new solution to a problem using the
kattis new command two additional fields are created:
||The name of the credentials to use when submitting|
||The id of the problem the solution solves|