Original Document
A checker
Python script must implement a function that is called by the judge:
def check(process_output, judge_output, **kwargs): # return True/False
Variables in global scope will exist throughout the grading process.
**kwargs
is a directory containing
submission_source
: the source code of the submissionjudge_input
: the judge’s inputpoint_value
: the point value of the test casecase_position
: the index of the test casebatch
: the batched the test case belongs tosubmission_language
: the language the submission was submitted inbinary_data
: a boolean, which isTrue
if the data was not normalized to Linux line endings, andFalse
otherwiseexecution_time
: the runtime of the program, in seconds
Additionally, if the check
method has the flag run_on_error
set, it will be run against the submission’s output, even if it receives an IR/TLE/RTE/MLE verdict.
The only built-in checker that has this flag set is the linecount
checker.
Return:
True
for correct output, False
for incorrect one
Sample Checker:
Here is the checker for the problem: Print 2 integers having sum equal to n (n is read from input).
def check(process_output, judge_output, judge_input, **kwargs): # process the input input_arr = judge_input.split() assert(len(input_arr) == 1) n = int(input_arr[0]) # process the contestant's output output_arr = process_output.split() if (len(output_arr) != 2): return False try: a, b = int(output_arr[0]), int(output_arr[1]) except: return False if (n == a + b): return True return False