Problem schema#
problem.rbx.yml#
Checker
#
Bases: CodeItem
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fallback_to
|
Checker | None
|
Checker to fall back to if the mainly specified checker does not exist. |
None
|
mode
|
Literal['testlib', 'boca']
|
In which compatibility mode the checker should be run. |
'testlib'
|
Source code in rbx/box/schema.py
CheckerTest
#
Bases: BaseModel
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
glob
|
str | None
|
A glob pattern for the files to be used as unit test input for the checker. |
None
|
testplan
|
Path | None
|
A testplan to be used as unit test input for the checker. |
None
|
outcome
|
ExpectedOutcome | None
|
The expected outcome of the checker. |
None
|
Source code in rbx/box/schema.py
CodeItem
#
Bases: BaseModel
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path
|
The path to the code file, relative to the package directory. |
required |
language
|
str | None
|
The language of the code file. |
None
|
compilationFiles
|
List[str] | None
|
Extra files that should be placed alongside the code file during its compilation, such as testlib.h, jngen.h, etc. The paths should be given relative to the package directory, but will be included
relative to the Testlib and jngen are already included by default. |
[]
|
Source code in rbx/box/schema.py
CodeItemWithDigest
#
Bases: CodeItem
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
digest
|
str
|
The digest of the code file. |
required |
Source code in rbx/box/schema.py
ExpectedOutcome
#
Bases: AutoEnum
Source code in rbx/box/schema.py
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 | |
ACCEPTED = alias('accepted', 'ac', 'correct')
#
Expected outcome for correct solutions (AC).
ACCEPTED_OR_TLE = alias('accepted or time limit exceeded', 'accepted or tle', 'ac or tle', 'ac/tle', 'ac+tle')
#
Expected outcome for solutions that finish with either AC or TLE.
Especially useful when you do not care about the running time of this solution, and want it to not be considered when calculating the timelimit for the problem.
ANY = alias('any')
#
Expected outcome for any outcome.
COMPILATION_ERROR = alias('compilation error', 'ce')
#
Expected outcome for solutions that finish with a compilation error verdict.
Only useful for checker tests.
INCORRECT = alias('fail', 'incorrect')
#
Expected outcome for solutions that finish with any non-AC verdict.
JUDGE_FAILED = alias('judge failed', 'jf')
#
Expected outcome for solutions that finish with a judge failed verdict.
Only useful for checker tests.
MEMORY_LIMIT_EXCEEDED = alias('memory limit exceeded', 'mle', 'ml')
#
Expected outcome for solutions that use more memory than allowed.
OUTPUT_LIMIT_EXCEEDED = alias('output limit exceeded', 'ole', 'ol')
#
Expected outcome for solutions that use more output than allowed.
RUNTIME_ERROR = alias('runtime error', 'rte', 're')
#
Expected outcome solutions that finish with non-zero code (RTE).
TIME_LIMIT_EXCEEDED = alias('time limit exceeded', 'timeout', 'tle', 'tl')
#
Expected outcome for solutions that do not finish in time.
TLE_OR_RTE = alias('tle or rte', 'tle/rte', 'tle+rte', 'tle or re', 'tle+re')
#
Expected outcome for solutions that finish with either TLE or RTE.
Especially useful for environments where TLE and RTE are indistinguishable.
WRONG_ANSWER = alias('wrong answer', 'wa')
#
Expected outcome for solutions that finish successfully, but the produced output are incorrect (WA).
Generator
#
GeneratorCall
#
Bases: BaseModel
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the generator to call. |
required |
args
|
str | None
|
The arguments to pass to the generator. |
None
|
Source code in rbx/box/schema.py
GeneratorScript
#
Bases: CodeItem
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
root
|
Path
|
The root directory where the generators should be fetched from. |
<dynamic>
|
format
|
Literal['rbx', 'box']
|
The format of the generator script. |
'rbx'
|
Source code in rbx/box/schema.py
Interactor
#
Bases: CodeItem
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
legacy
|
bool
|
Whether this interactor is a legacy interactor and needs a checker to be specified. |
False
|
Source code in rbx/box/schema.py
LimitModifiers
#
Bases: BaseModel
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
timeMultiplier
|
float | None
|
Multiplier for time limit. |
None
|
time
|
int | None
|
Value to override time limit with, in milliseconds. |
None
|
memory
|
int | None
|
Value to override memory limit with, in MB. |
None
|
Source code in rbx/box/schema.py
LimitsProfile
#
Bases: BaseModel
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
inheritFromPackage
|
bool
|
Whether to inherit limits from the package. |
False
|
timeLimit
|
int | None
|
Time limit of the problem, in milliseconds. |
None
|
memoryLimit
|
int | None
|
Memory limit of the problem, in MB. |
None
|
outputLimit
|
int | None
|
Output limit of the problem, in KB. |
None
|
modifiers
|
Dict[str, LimitModifiers]
|
Limit modifiers that can be specified per language. |
{}
|
formula
|
str | None
|
A formula to estimate the time limit for the problem. |
None
|
Source code in rbx/box/schema.py
OutputFromItem
#
Bases: CodeItem
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stderr
|
bool
|
Whether the output should be taken from stderr instead of the stdout. |
False
|
Source code in rbx/box/schema.py
OutputFromItemWithDigest
#
Bases: OutputFromItem, CodeItemWithDigest
Source code in rbx/box/schema.py
Package
#
Bases: BaseModel
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the problem. |
required |
titles
|
Dict[str, str]
|
Titles for the problem in each language. Languages should be specified as lowercase ISO 639-1 codes. |
{}
|
type
|
TaskType
|
The type of the problem. |
BATCH
|
scoring
|
ScoreType
|
The scoring type of the problem. |
BINARY
|
timeLimit
|
int
|
Time limit of the problem, in milliseconds. |
required |
memoryLimit
|
int
|
Memory limit of the problem, in MB. |
required |
outputLimit
|
int
|
Output limit of the problem, in KB. |
4096
|
modifiers
|
Dict[str, LimitModifiers]
|
Limit modifiers that can be specified per language. |
{}
|
checker
|
Checker | None
|
The checker for this problem. |
None
|
interactor
|
Interactor | None
|
The interactor for this problem. |
None
|
validator
|
CodeItem | None
|
The validator for this problem. |
None
|
extraValidators
|
List[CodeItem]
|
Extra validators for this problem. |
[]
|
outputValidators
|
List[CodeItem]
|
A list of output validators to use to validate the output of the testcases of this problem. |
[]
|
visualizer
|
Visualizer | None
|
The visualizer for this problem. Used to produced visualizations for the testcases. |
None
|
solutionVisualizer
|
Visualizer | None
|
The solution visualizer for this problem. Used to produced visualizations for the outputs of the testcases. |
None
|
generators
|
List[Generator]
|
Generators for this problem. |
[]
|
solutions
|
List[Solution]
|
All tested solutions for this problem. The first solution in this list should be the main solution -- the one
that is correct and used as reference -- and should have the |
[]
|
testcases
|
List[TestcaseGroup]
|
Testcases for the problem. |
[]
|
stresses
|
List[Stress]
|
Stress tests for the problem. |
[]
|
statements
|
List[Statement]
|
Statements for the problem. |
[]
|
vars
|
TypeAliasType
|
Variables to be re-used across the package. |
{}
|
unitTests
|
UnitTests
|
Unit tests for components of this problem. |
<dynamic>
|
Source code in rbx/box/schema.py
789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 | |
ScoreType
#
Bases: AutoEnum
Source code in rbx/box/schema.py
Solution
#
Bases: CodeItem
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
outcome
|
ExpectedOutcome
|
The expected outcome of this solution. |
ANY
|
tags
|
List[str]
|
Tags to be associated with this solution. |
[]
|
score
|
int | Tuple[int | None, int | None] | None
|
The score of this solution in the final score. Should either be an integer, which means the solution should have this exact score, or a tuple of two integers, which means the solution should have a score between the two integers (inclusive). If one of the integers is set to be null, it means that the solution should have a score between the other integer and negative/positive infinity. |
None
|
Source code in rbx/box/schema.py
Stress
#
Bases: BaseModel
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the stress test. |
required |
generator
|
GeneratorCall
|
Generator pattern to call during stress-test. |
required |
finder
|
str
|
Finder expression to be used to match against generated tests. |
required |
Source code in rbx/box/schema.py
TaskType
#
Bases: AutoEnum
Source code in rbx/box/schema.py
Testcase
#
Bases: BaseModel
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
inputPath
|
Path
|
The path of the input file. |
required |
outputPath
|
Path | None
|
The path of the output file. |
None
|
Source code in rbx/box/schema.py
TestcaseGroup
#
Bases: TestcaseSubgroup
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
subgroups
|
List[TestcaseSubgroup]
|
A list of test subgroups to define for this group. |
[]
|
validator
|
CodeItem | None
|
A validator to use to validate the testcases of this group. If specified, will use this validator instead of the package-level validator. Useful in cases where the constraints vary across test groups. |
None
|
score
|
int
|
The score of this group in the final score. Useful for problems that have points. |
0
|
deps
|
List[str]
|
A list of other groups this group depends on to run and be considered accepted. The |
[]
|
model_solution
|
ForwardRef('Optional[Solution]')
|
The solution to be used to generate outputs for this testgroup. Can only be set for the "samples" testgroup. |
None
|
Source code in rbx/box/schema.py
TestcaseSubgroup
#
Bases: BaseModel
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the test group. |
required |
testcases
|
List[Testcase]
|
The path of testcases to add to this group, in the order they're defined. |
[]
|
testcaseGlob
|
str | None
|
A Python glob that matches input file paths relative to the package directory. The globbed files should end with the extension ".in", and their corresponding outputs, if defined, should have the same file name, but ending with ".ans". |
None
|
generators
|
List[GeneratorCall]
|
A list of generators to call to generate testcases for this group. |
[]
|
generatorScript
|
GeneratorScript | None
|
A generator script to call to generate testcases for this group. |
None
|
extraValidators
|
List[CodeItem]
|
A list of extra validators to use to validate the testcases of this subgroup. |
[]
|
outputValidators
|
List[CodeItem]
|
A list of output validators to use to validate the output of the testcases of this subgroup. |
[]
|
visualizer
|
Visualizer | None
|
The visualizer for this problem. Used to produced visualizations for the testcases. Has priority over the visualizer specified in the package. |
None
|
solutionVisualizer
|
Visualizer | None
|
The solution visualizer for this problem. Used to produced visualizations for the outputs of the testcases. Has priority over the solution visualizer specified in the package. |
None
|
Source code in rbx/box/schema.py
UnitTests
#
Bases: BaseModel
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
validator
|
List[ValidatorTest]
|
Unit tests for the validator. |
[]
|
checker
|
List[CheckerTest]
|
Unit tests for the checker. |
[]
|
Source code in rbx/box/schema.py
ValidatorOutcome
#
Bases: AutoEnum
Source code in rbx/box/schema.py
ValidatorTest
#
Bases: BaseModel
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
glob
|
str | None
|
A glob pattern for the input files to be used as unit test input for the validator. |
None
|
testplan
|
Path | None
|
A testplan to be used as unit test input for the validator. |
None
|
outcome
|
ValidatorOutcome | None
|
The expected outcome of the validator. |
None
|
validator
|
CodeItem | None
|
The validator to use for this test. If not specified, will use the package-level validator. |
None
|
Source code in rbx/box/schema.py
Visualizer
#
Bases: CodeItem
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
extension
|
str
|
The extension of the visualization file generated by the visualizer. |
required |
answer_from
|
Literal['stderr'] | OutputFromItem | None
|
Program to generate additional answer file to pass to the visualizer. If not specified, the reference answer file will be used. |
None
|
Source code in rbx/box/schema.py
Statements#
Statement
#
Bases: BaseModel
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Name of this statement. |
required |
inheritFromContest
|
bool
|
Whether the configuration for this statement should be inherited from the contest. When this field is set to true, the statement for this problem can only be built if it's within a contest and there is a contest statement matching it. |
False
|
extends
|
str | None
|
Name of the statement that this statement extends. |
None
|
language
|
str
|
Language code of this statement (ISO 639-1). |
'en'
|
title
|
str | None
|
Title of the problem, as it appears in the statement. Can be left unset if the problem has no title or if title comes from the |
None
|
path
|
Path
|
Path to the input statement file. |
<dynamic>
|
type
|
StatementType
|
Type of the input statement file. |
rbxTeX
|
steps
|
List[TexToPDF | JinjaTeX | rbxToTeX | rbxMarkdownToTeX]
|
Describes a sequence of conversion steps that should be applied to the statement file. Usually, it is not necessary to specify these, as they can be inferred from the input statement type and the output statement type, but you can use this to force certain conversion steps to happen. |
[]
|
configure
|
List[TexToPDF | JinjaTeX | rbxToTeX | rbxMarkdownToTeX]
|
Configure how certain conversion steps should happen when applied to the statement file. Different from the |
[]
|
assets
|
List[str]
|
Assets relative to the package directory that should be included while building
the statement. Files will be included in the same folder as the statement file, preserving
their relativeness. Can be glob pattern as well, such as |
[]
|
vars
|
TypeAliasType
|
Variables to be used in the statement. |
{}
|
samples
|
bool
|
Whether to build the statement with samples. |
True
|
Source code in rbx/box/statements/schema.py
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 | |
StatementType
#
Bases: AutoEnum
Source code in rbx/box/statements/schema.py
rbxTeX = alias('rbx-tex')
#
Statement written in rbxTeX format.
rbxMarkdown = alias('rbxMd', 'rbx-markdown', 'rbx-md')
#
Statement written in rbxMarkdown format.
TeX = alias('tex')
#
Statement written in pure LaTeX format.
JinjaTeX = alias('jinja-tex')
#
Statement written in LaTeX format with Jinja2 expressions.
PDF = alias('pdf')
#
Statement is a PDF.
Conversion nodes#
ConversionType
#
Bases: str, Enum
Source code in rbx/box/statements/schema.py
JinjaTeX = 'jinja-tex'
class-attribute
instance-attribute
#
Conversion from LaTeX with Jinja2 expressions to LaTeX.
TexToPDF = 'tex2pdf'
class-attribute
instance-attribute
#
Conversion from LaTeX to PDF using pdfLaTeX.
rbxMarkdownToTeX = 'rbx-md-tex'
class-attribute
instance-attribute
#
Conversion from rbxMarkdown to LaTeX.
rbxToTex = 'rbx-tex'
class-attribute
instance-attribute
#
Conversion from rbxTeX to LaTeX.
JinjaTeX
#
JoinTexToPDF
#
Bases: BaseModel
Configures the joining of contest and problem texes to PDF.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
type
|
Literal['tex2pdf']
|
|
required |
Source code in rbx/box/statements/schema.py
JoinerType
#
Bases: str, Enum
Source code in rbx/box/statements/schema.py
TexToPDF = 'tex2pdf'
class-attribute
instance-attribute
#
Join contest tex and problem texs to PDF using pdfLaTeX.
TexToPDF
#
Bases: BaseModel
Configures the conversion between LaTeX and PDF using pdfLaTeX.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
type
|
Literal['tex2pdf']
|
|
required |
externalize
|
bool
|
Whether to externalize TikZ graphics. |
False
|
Source code in rbx/box/statements/schema.py
rbxMarkdownToTeX
#
Bases: BaseModel
Configures the conversion between rbxMarkdown and LaTeX.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
type
|
Literal['rbx-md-tex']
|
|
required |
Source code in rbx/box/statements/schema.py
rbxToTeX
#
Bases: BaseModel
Configures the conversion between rbxTeX and LaTeX.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
type
|
Literal['rbx-tex']
|
|
required |
template
|
Path
|
Path to the template that should be used to render the rbx-tex blocks. |
PosixPath('template.rbx.tex')
|
externalize
|
bool
|
Whether to externalize TikZ graphics. |
False
|