-
Notifications
You must be signed in to change notification settings - Fork 11
Interactive Tasks
This guide will help you go through the process of creating an interactive task in kjudge!
- Download sample dataset
- Create problem
- Create test groups
- Prepare checker file
- Prepare build script
- The end
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:
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.
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:
The score of each test group is based on the score for each subtask in the original problem.
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:
To compile simurgh
checker, you need to submit two files to kjudge: checker.cpp
and testlib.h
.
Note: you need to rename the checker file because kjudge only accepts checker file named compare
.
Afer that, you can compile the checker file directly in kjudge.
For more details about writing a custom checker, refer to CMS's checker style and Custom diffs
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:
In kjudge, the necessary files for simurgh
will look like this:
For more details about writing a custom compiler, refer to Custom Compilers.
To test whether you follow all steps correctly, you can try to submit a .cpp
code in the simurgh/solution
folder.
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!