IORedir

Please refer to the document IORedir Check Type for how to package IORedir problems.

Diagram

(*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.

Example 1

checker.cpp
Json config
Problem package

In this example, file descriptors of the test program are configured as:

0 (standard input): Test input file.
1 (standard output): Pipe to the checker.

File descriptors of the checker are configured as:

0 (standard input): Pipe from the test program.
2: Test answer file.

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.

Example 2

TBD