Skip to content

Interactive Tasks

aome edited this page Apr 15, 2020 · 17 revisions

This guide will guide you through the process of creating an interactive task in kjudge!

Download sample dataset

This guide uses an interactive problem called simurgh from IOI 2017 to help illustrate the steps of preparing an interactive problem. You can download the problem's dataset here.

After downloading and extracting the dataset, the simurgh folder will look like this:

simurgh folder

Create problem

First, you need to add a problem to a contest in kjudge.

In this guide, a problem named simurgh is added to the Weighted contest to kjudge's test database.

simurgh create problem

Create test groups

After creating a new problem, you need to create test groups and add tests to each test group.

Follow the instructions in Hosting a contest to create test groups for the problem.

In this guide, simurgh test groups in kjudge will look this:

simurgh test groups

The score of each test group is based on the score for each subtask in the original problem.

Prepare checker file

When preparing an interactive task, you need to implement a checker file.

Kjugde only accepts checker file named compare and it follows CMS's checker style.

In the simurgh folder, there is a folder named checker which contains all the codes needed for the problem's checker:

simurgh checker

To compile the problem's checker, run make, which gives you a file named checker.exe.

Note that you need to rename the checker file because kjudge only accepts checker file named compare.

After that, you can upload the checker file to kjudge:

simurgh upload checker

Prepare build script

To grade an interactive task, you need to customize a build script for each programming language you want to support.

A build script must be named compile_[language].sh - language can be one of cc, go, rs, java, py2, py3.

This guide will illustrate steps of writing a build script for C++. Writing a build script for other languages is similar.

In the simurgh folder, there is a folder named grader/cpp, which contains files grader.cpp and simurgh.h to compile contestant's solution in C++.

The C++ build script for simurgh is g++ -O2 -static grader.cpp code.cc -o code, which is put into compile_cc.sh.

Note: in kjudge, contestant's submitted solution is named code.[language] and the compiled binary file is code.

After writting the build script, you can upload the build script and other required files (headers, provided libraries, ...) to kjudge:

simurgh build script

simurgh build script upload

In kjudge, the necessary files to grade simurgh will look like this

simurgh files

The end

To test whether you follow all steps correctly, you can try to submit a .cpp code in simurgh/solution folder.

simurgh submit

simurgh submit result

You have completed all the steps to create an interactive task in kjuges. It's really simple, right?

Now, you can try to create your own interactive task in kjudge!

Clone this wiki locally