Cheatsheet#
CLI#
Below you can find a list of common rbx commands. You can read more about each of them in the CLI reference.
Task | Command |
---|---|
Show help message | rbx --help |
Open rbx configuration for editing | rbx config edit |
Create a new package in folder package |
rbx create package |
Compile a file given its path | rbx compile my/file.cpp |
Open the problem configuration in a text editor | rbx edit |
Generate all testcases | rbx build |
Use dynamic timing to estimate time limits | rbx time |
Run all solutions and check their tags | rbx run |
Run all solutions with sanitizer | rbx run -s |
Run all solutions with dynamic timing | rbx run -t |
Run all solutions except the slow ones | rbx run -v2 |
Run all solutions without checking | rbx run --nocheck |
Run a single solution | rbx run sols/my-solution.cpp |
Choose solutions and run | rbx run -c |
Run all solutions interactively | rbx irun |
Choose solutions and run interactively | rbx irun -c |
Run solutions in a single testcase | rbx irun -t samples/0 |
Run solutions in a generator testcase | rbx irun -g gen 5 10 |
Interactively visualize outputs of a recent run | rbx ui |
Run the validator interactively | rbx validate |
Run a stress test with name break |
rbx stress break |
Run a stress test for a generator | rbx stress gen -g "[1..10]" -f "[sols/main.cpp ~ INCORRECT]" |
Run unit tests for validator and checker | rbx unit |
Download testlib to the current folder | rbx download testlib |
Download jngen to the current folder | rbx download jngen |
Download a built-in testlib checker | rbx download checker wcmp.cpp |
Build all statements | rbx statements build |
Build a specific statement | rbx statements build <name> |
Build statements for English | rbx statements build -l en |
Package problem for Polygon | rbx package polygon |
Package problem for BOCA | rbx package boca |
Package problem for BOCA but only validate | rbx package boca -v1 |
List all languages available in the environment | rbx languages |
Format all YAML configuration files in the package | rbx fix |
Clear cache | rbx clear |
Contest CLI#
Task | Command |
---|---|
Show help message | rbx contest --help |
Create a new contest in folder package |
rbx contest create package |
Add a new problem to the contest with letter A | rbx contest add new-problem A |
Remove a problem from the contest | rbx contest remove A |
Remove a problem at a certain path | rbx contest remove path/to/problem |
Open the contest configuration in a text editor | rbx contest edit |
Build all statements | rbx contest statements build |
Build a specific statement | rbx contest statements build <name> |
Build statements for English | rbx contest statements build en |
Package contest for Polygon | rbx contest package polygon |
Build each problem in the contest | rbx contest each build |
Package each problem in the contest | rbx contest each package boca |
Build problem A in the contest | rbx contest on A build |
Build problems A to C in the contest | rbx contest on A-C build |
problem.rbx.yml
#
Change problem constraints#
timeLimit: 1000 # In milliseconds
memoryLimit: 256 # In megabytes
modifiers:
java:
time: 5000 # Override time for Java
Add testlib assets#
Set a built-in testlib checker#
Set a custom checker#
See here how to write a custom testlib checker.
Add a generator#
Add a new generator entry to the generators
field.
See here how to write a testlib-based generator.
Tip
To actually generate tests with this new generator, you have to add testcase groups and call the generator.
Set a validator#
See here how to write a testlib-based validator.
Set an interactor#
See here how to write a testlib-based interactor.
Add a new solution#
Implement your solution (for instance, a wrong solution in sols/my-wa-solution.cpp
) and add it to the solutions
field.
You can see the list of possible expected outcomes here.
Add testcases#
Add a testcase group with manually defined tests#
testcases:
# ...other testcase groups
- name: "manual-tests"
testcaseGlob: "tests/manual/*.in" # (1)!
-
Import all tests in the
tests/manual/
folder in lexicographic order.The test input files must end in
.in
.
Add a testcase group with a list of generated tests#
testcases:
# ...other testcase groups
- name: "single-generated"
generators:
- name: "gen"
args: "1000 123" # (1)!
- name: "gen"
args: "1000 456" # (2)!
- A generated test obtained from the output of the command
gen 1000 123
. - A generated test obtained from the output of the command
gen 1000 456
.
Add a testcase group with a list of generated tests from a generator script#
Add a testcase group with a list of generated tests from a dynamic generator script#
Add testgroup-specific validator#
validator:
path: "my-validator.cpp"
testcases:
- name: "small-group"
# Define tests...
validator:
path: "my-small-validator.cpp" # (1)!
- name: "large-group"
# Define tests...
- Add a specific validator to verify constraints of a smaller sub-task of the problem.
Add variables#
The variables below can be reused across validators and statements.
vars:
"MAX_N": 1000
"MAX_V": 100000
"MOD": py`10**9+7` # Backticks force the var to be evaluated as a Python expression.
Use variables#
Add statements#
Add a rbxTeX statement#
statements:
# ...other statements
- name: 'statement-en'
title: "My problem"
path: "statement/statement.rbx.tex" # (1)!
type: rbxTeX
language: 'en'
configure:
- type: 'rbx-tex'
template: statement/template.rbx.tex' # (2)!
assets: ['statement/olymp.sty', 'statement/*.png'] # (3)!
-
Defines the path to the rbxTeX file, where the building blocks of the statement will be defined.
-
Defines how a rbxTeX file will be converted to a normal TeX file. Here, we link the template where our rbxTeX sections such as legend, input and output will be inserted into.
-
Defines assets that should be linked when the resulting statement is being compiled.
Extends other rbxTeX statements#
statements:
- name: 'statement'
title: 'My problem'
path: "statement/statement.rbx.tex"
type: rbxTeX
language: 'en'
configure:
- type: 'rbx-tex'
template: statement/template.rbx.tex'
assets: ['statement/olymp.sty', 'statement/*.png']
- name: 'statement-pt'
title: 'Meu problema'
extends: 'statement' # (1)!
language: 'pt'
path: 'statement/statement-pt.rbx.tex' # (2)!
-
The
statement-pt
statement will inherit the properties of thestatement
statement, and override a subset of them. -
The
statement-pt
statement will use a different rbxTeX file, since we need to rewrite the building blocks of the statement in another language.
Add a PDF statement#
statements:
# ...other statements
- title: "My problem"
path: "statement/statement.pdf"
type: PDF
language: 'en'
Add a stress test#
Add a stress to look for an error in a solution#
stresses:
- name: "my-stress"
generator:
name: 'gen'
args: '[1..<MAX_N>] @' # (1)!
finder: "[sols/my-wa-solution.cpp] ~ INCORRECT" # (2)!
-
The
<MAX_N>
variable expands into thevars.MAX_N
value that could be declared inproblem.rbx.yml
.The
[1..<MAX_N>]
picks a random number in this interval before generating every test in the stress run.The
@
appends a few extra random characters to the end of the generator call to re-seed the generator. -
Expression that refers to solution
sols/my-wa-solution.cpp
and check whether it returns an incorrect outcome.
Add a stress to look for a test that causes TLE in a solution#
stresses:
- name: "my-stress"
generator:
name: 'gen'
args: '1000000 @' # (1)!
finder: "[sols/my-potentially-slow-sol.cpp] ~ TLE"
- The
@
at the end of theargs
string appends a random string to it. This is necessary here becausegen 100000
would return the same testcase over and over, since testlib rng is seeded from its command line argc and argv.
Add unit tests#
unitTests:
validator:
- glob: "unit/validator/valid_*.in" # (1)!
outcome: VALID
- glob: "unit/validator/invalid_*.in"
outcome: INVALID
checker:
- glob: "unit/checker/ac*" # (2)!
outcome: ACCEPTED
- glob: "unit/checker/wa*"
outcome: WRONG_ANSWER
# ...other checker unit tests
-
Matches
.in
files relative to the problem root directory that when validated should be considered valid. -
Matches
.in
,.out
,.ans
files that when checked should be considered ACCEPTED.