Please refer to the document IORedir Check Type for how to package IORedir problems.
(*1) You can set the test program's pipeout
to an arbitrary file descriptor (e.g. 100)
, and also set the checker's pipeout
to an arbitrary file descriptor (e.g. 200)
. Write a loop in the checker to read pipeout (e.g. 200)
until reaching EOF. The EOF indicates that the test program has closed the pipeout file descriptor
, which means the test program has exited.
checker.cpp
Json config
Problem package
In this example, file descriptors of the test program are configured as:
File descriptors of the checker are configured as:
Therfore, checker can read the test program's output from its stdin
, and read the answer from file descriptor 2
. It will compare them, and if there is any difference, exits with -1 (wrong answer).
If you are creating an interactive problem, be sure that both the test and checker use setvbuf
to disable the output buffers. Otherwise the pipes could cause deadlock.
TBD