Cheatsheet
CLI
Task | Command |
---|---|
Show help message | rbx --help |
Create a new package in folder package |
rbx create package |
Compile a file given its path | rbx compile any my/file.cpp |
Open the problem configuration in a text editor | rbx edit |
Generate all testcases | rbx build |
Generate all testcases and run validators | rbx verify |
Run all solutions and check their tags | rbx run |
Run all solutions except the slow ones | rbx run -v2 |
Run all solutions without checking | rbx run --nocheck |
Run all solutions interactively | rbx irun |
Run a stress test with name break |
rbx stress break |
Run a stress test for a generator | rbx stress gen -g "[1..10]" -s sols/main.cpp |
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 PDF statements | rbx statements build --output=pdf |
Build PDF statements for English | rbx statements build en --output=pdf |
Package problem for Polygon | rbx package polygon |
Package problem for BOCA | rbx package boca |
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 |
Open the contest configuration in a text editor | rbx contest edit |
Build PDF statements | rbx contest statements build --output=pdf |
Build PDF statements for English | rbx contest statements build en --output=pdf |
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 |
problem.rbx.yml
Change problem constraints
Add testlib assets
Set a built-in testlib checker
Set a custom checker
Add a generator
Add a new generator entry to the generators
field.
Tip
To actually generate tests with this new generator, you have to add testcase groups and call the generator.
Set a validator
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 roboxTeX statement
statements:
# ...other statements
- title: "My problem"
path: "statement/statement.rbx.tex"
type: roboxTeX
language: 'en'
pipeline:
- type: 'rbx-tex'
template: statement/template.rbx.tex' # (1)!
assets: ['statement/olymp.sty', 'statement/*.png'] # (2)!
-
Defines how a roboxTeX file will be converted to a normal TeX file. Here, we link the template where our roboxTeX sections such as legend, input and output will be inserted into.
-
Defines assets that should be linked when the resulting statement is being compiled.
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)!
solutions:
- path: "sols/my-potentially-wrong-sol.cpp"
-
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.
Add a stress to look for a test that causes TLE in a solution
stresses:
- name: "my-stress"
generator:
name: 'gen'
args: '1000000 @' # (1)!
solutions:
- path: "sols/my-potentially-slow-sol.cpp"
outcome: 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.