Skip to content

Fix score parsing for testlib.h interactive problems with non-constant scores #1209

@Chifwin

Description

@Chifwin

Currently there is problem with score parsing for IOI interactive problems created with testlib.h on Polygon, when score isn't constant and depends on quality of the solution (e.g., number of moves made). For this cases, testlib.h provides quitp function.
This function print to stderr message (in Python f-string syntax):
"points {points} {custom message} (test case {test case number})"
Current score parsing uses regex: re.compile(br'^points (\d+)$', re.M), which fails on this output because of whitespace.
As a temporary fix, users can manually print a separate line that matches the expected format, e.g.:
quitp(points, "\npoints %d\n", points);
Proposed solution: update the regex to a more flexible version that still captures the score correctly. Suggested change:
re.compile(br'^points (\d+)', re.M)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions