Skip to content

Hosting a Contest

Natsu Kagami edited this page Apr 13, 2020 · 3 revisions

This guide will assume that kjudge stays on the URL http://localhost:8080. If you set kjudge to listen somewhere else, change the URLs accordingly!

1. Accessing the Admin Panel

The Admin Panel is where all the contest and user management takes place. It is not visible from the kjudge homepage, however it can always be accessed by opening the URL:

https://localhost:8080/admin

Admin Key and Logging into the Admin Panel

On the first time accessing the Admin Panel, you will be prompted for the admin key, with a page looking like this:

Admin Panel Login

Please enter the key, which can be found in:

  • Your configuration option -e ADMIN_KEY=[your_key_here], if you are running kjudge from Docker.

  • The environment variable ADMIN_KEY, if one has been set.

  • If neither of the above has been set, kjudge will attempt to give you one. Look in kjudge's first lines of output, you will see something like Admin Key is Generated

    You can use the generated string as the admin key, until kjudge is restarted.

2. Creating a Contest

The Create a Contest button is easily accessible from the Admin Panel's home page.

Alternatively, going to Contests on the Admin Panel menu also takes you to the Contests page, where the Add a Contest form will be at the bottom.

The New Contest Form

New Contest form

  • Name: The contest name. This will be used in the entire Contest page.

  • Contest Type: Currently there are two contest types supported:

    • Weighted: You can set scores for each problem, and contestants are ranked in a scoreboard by the total score they achieved, before penalties.
    • Unweighted: Scores for each problem are ignored, and contestants are ranked by the number of solved (i.e. full score) problems, followed by penalties.

    There are a bit more subtle differences between the two, that will be explained in the Contest types page. But in short, weighted are more close to IOI-style contests, while unweighted is closer to ICPC-style contests.

  • Scoreboard View Status: State whether everyone can access the contest scoreboard during the contest. There are 3 options:

    • Public view: Everyone can access the scoreboard.
    • User view: Anyone who has logged in can access the scoreboard.
    • No Scoreboard: No one can access the scoreboard.

    Two things to note:

    • As an admin, you can always access the scoreboard from the Admin Panel.
    • After the contest ends, everyone can access the scoreboard, no matter the settings.
  • Start Time and End Time: The start and end time of the contest. They must be given in UTC time zone, since kjudge cannot differentiate between timezones of the contestants versus its own (time is hard). To help you with UTC time differences from your own, the current time in UTC timezone is given below the form.

3. Adding a Problem

After creating a contest, you will be redirected to the Contest Edit page.

To edit another contest, you can find the [e] (edit) button on the right of each contest listed in the Contests page.

Admin Panel - contest page

Unlike the panel above, our contest actually has no problems yet! Let's try adding one.

Add a Problem form

  • #: Give the problem a short name, usually its ordering, like A or 1. The problems will be sorted (alphabetically) in the order of this short name.
  • Name: The actual, longer name of the problem. Not too long though, keep it simple! IOI problem names should be a great example.
  • Time Limit: How much time the contestant's code is allowed to spend in each test. Note that this is in milliseconds, so 1 second = 1000 milliseconds.
  • Memory Limit: How much memory the contestant's code is allowed to access in each test. This is in kilobytes. Some common options are:
    • 256MBs: 262144 KBs
    • 512MBs: 524288 KBs
    • 1GB: 1048576 KBs
  • Scoring Mode: dictates how the best submission, among one contestant's all submissions, is selected for ranking. The options are briefly explained in the form. For more details, check out Problem and Subtasks.
  • Penalty Policy: dictates how a submission's penalty is calculated. Again, options are briefly explained in the form. For more details, check out Problem and Subtasks.

4. Add some tests

After creating a problem, you will be taken to the Problem Edit page.

Test groups

In kjudge, tests in a problem are always grouped into Test Groups. From the Contestant's point of view, they are called Subtasks to match IOI's description. However, test groups in kjudge are a bit more useful.

Let's try creating one.

Admin Panel - Test Groups management

  • Name: Every test group has a name. As with the problem's short name, test groups will be displayed in the alphabetical order of their names. Usually this is just the subtask number (1 or Subtask 1), or an important distinction between groups (pretests, main, samples).

  • Score: The maximum score that a contestant can get from solving this test group. Usually example tests have a score of 0, while others have a positive value. The maximum score of a problem will then be the sum of all scores of its subtasks.

    There is one exception to this: If the score of a subtask is negative, then it will act as if its score is 0, but its results will not be showed to contestants. This is helpful when, for example, you want to have pretests and main tests, but want kjudge to run all tests from the beginning (e.g. so that as an admin, you still see all results). Later on when you change the score of the group to a positive value, tests do not have to be re-run.

  • Scoring Mode: dictates how the outcome of each test (which will be a number from 0 to 1) will add up to the total score of the group. Just like with Problem's Scoring Mode, options are briefly explained in the form. For more details, check out Problem and Subtasks.

  • Time Limit and Memory Limit: you can assign a custom time and memory limit to this subtask. If left blank, they will have the same values as the problem.

Uploading Tests

After creating a test group, you will be taken to the test group management page. Two forms will open up for test uploading.

Test uploading form

Single test upload is fairly simple: Just upload a pair of input/output files, along with a test name. Tests are sorted alphabetically by name, as you might've guessed.

Multiple test upload is a bit more involved:

  • You prepare a .zip file containing all the tests.

  • Each test would have a "filename pattern" for its input and output. In the pattern, they would share a part and differ in exactly one position for different tests.

    For example, if you have 4 files

    1.in     1.out     2.in    2.out
    

    Then the pattern would be ?.in and ?.out for input and output files respectively.

    Similarly, with

    files/1/input.txt files/1/output.txt files/2/input.txt files/2/output.txt
    

    Then the pattern is files/?/input.txt and files/?/output.txt. The differing parts would become the tests' names.

  • You can also check Delete all tests so that the uploaded tests become the only tests. Otherwise, kjudge will complain if there is any conflicts in the tests' name.

Upload files

Let's come back to the Problem page.

Problems also have accompanying files:

These files can be uploaded from the Files table.

Add files to Problem

  • Files can be uploaded in batch, but then Rename file won't work.
  • The files' role is determined by its filename. Some examples are given in the form, as shown.
  • Tick the Make public option to make the file freely downloadable by the contestant.

5. That's all!

Add some more problems, and you are good to go!

By default, kjudge allows registration. However, if you want to manage users manually, it can be done through the Users page.