Skip to content

Interactive Tasks

Thang Pham edited this page Apr 19, 2020 · 17 revisions

This guide will help you go 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 in 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 like 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.

Kjudge 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 simurgh checker, you need to submit two files to kjudge: checker.cpp and testlib.h.

simurgh upload checker

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

simurgh upload checker 2

Afer that, you can compile the checker file directly in kjudge.

simurgh compile checker

simurgh checker result

For more details about writing a custom checker, refer to CMS's checker style and Custom diffs

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 or code.pyc for python.

After writting the build script, you can upload the build script and other required files (headers, provided libraries, ...) in the problem's New File form:

simurgh build script

simurgh build script upload

In kjudge, the necessary files for simurgh will look like this:

simurgh files

For more details about writing a custom compiler, refer to Custom Compilers.

The end

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

simurgh submit

simurgh submit result

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

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