Skip to content

Limits profiles#

A limits profile is a file holding one set of limits for the problem — a time limit, a memory limit, and any per-language adjustments to them. Profiles live in .limits/ and are named, so a problem can carry several at once.

They exist because one problem does not have one time limit. The judge park the contest runs on is not your laptop, and the judge you package for is neither. Keeping the limits out of problem.rbx.yml and in a file per target lets you tune each one without the others moving.

What a profile is#

Each profile is a YAML file under .limits/, named after the target it describes:

my-problem/
├── problem.rbx.yml
└── .limits/
    ├── local.yml      # the default: what `rbx run` uses
    ├── boca.yml       # named for a packager, not for you
    └── polygon.yml

local is the one you get when you ask for nothing. The other two are named after packagers, which is not a convention you chose — see Profiles and packaging.

Estimate one, and read it back:

Besides the two limits, the file stores the per-language modifiers rbx derived, the ratios it estimated under, a per-group record of where each number came from, and, at the end, a solutions list with what each solution measured. A profile written by rbx time --run-all also ends with a runs list: the verdict every other solution got at the estimated limit. You don't have to read any of it, and you shouldn't hand-maintain it — it is written for you, and the LimitsProfile schema is the authority on what it holds.

The two fields you will set by hand are the limits themselves:

.limits/local.yml
timeLimit: 200        # milliseconds
memoryLimit: 256      # MB

Per-language modifiers#

A single time limit across every language is unfair to the slow ones. modifiers adjusts the limit for one language without touching the rest:

.limits/local.yml
timeLimit: 200
modifiers:
  py:
    time: 600           # (1)!
  java:
    timeMultiplier: 2.0 # (2)!
  1. Python gets 600 ms outright, replacing the base limit.
  2. Java gets twice whatever the base limit is — 400 ms here. A multiplier follows the base limit when it changes; an absolute time does not.

memory works the same way for the memory limit. When a language has both time and timeMultiplier, the multiplier applies to the time you set.

Tip

You rarely write modifiers yourself. The language groups picker in rbx time estimates a limit per group and writes the modifiers that express it.

Running solutions against a profile#

rbx run and rbx irun take the profile by name:

rbx run -p boca
rbx irun --profile=polygon
rbx -p boca run          # (1)!
  1. The flag exists on rbx itself as well as on the subcommand. The two mean the same thing, and the subcommand's wins if you pass both.

rbx run fails if the profile does not exist, rather than falling back to something you did not ask for.

Building statements against a profile#

Statements print the time limit, so they need to know which one:

rbx statements build -p icpc
rbx contest statements build -p icpc

At problem level a missing profile is an error. At contest level the problems that lack it are skipped with a warning, so one unprofiled problem does not stop the build. See Building statements.

The flag sets the active profile, and problem.limits in the template follows it — which is what you want when the same statement is built once per judge. A statement can also name a profile itself, through problem.profiles:

Time limit: \VAR{problem.limits.timeLimit} ms          %# (1)!
Time limit on the judge: \VAR{problem.profiles.boca.timeLimit} ms   %# (2)!
  1. Whichever profile the build is running under, so this line changes with -p.
  2. Always the boca profile, whatever -p said. Every profile in .limits/ is reachable this way, keyed by name.

Reach for the second form when one document has to state a limit that is not the one it is being built against — an editorial quoting the contest's limit, or a handout comparing two judges. Naming a profile that does not exist is an error at render time, so a statement cannot quietly print nothing.

The template context page has the rest of the problem namespace.

Profiles and packaging#

Each packager looks for a profile named after itself, which is how a package gets the limits meant for its judge:

rbx time -p boca
rbx package boca

Warning

A packager whose judge enforces limits requires its profile. Without one it stops and names the command that would create it, rather than shipping a package with limits measured for something else.

When an estimate goes stale#

An estimate is only as good as what it was measured against. Rewrite a solution, add a slow one, change a generator, and the number in the profile stays as it was.

So rbx records what it measured, next to the number:

.limits/boca.yml
timeLimit: 1400
estimationChecksum: 'v1.h.9f3a1c22.4b7e0d81.c1a8f930'

That string is a checksum of the solutions the estimate was derived from — the accepted ones that set the limit and the slow ones that validated it — plus, when the tests had been built, the interactor and the test inputs themselves. The commands that use a profile — rbx run -p, rbx package, rbx st b -p, rbx time — recompute it and warn you when it no longer matches:

The time limit saved in profile boca is stale: the solutions it was estimated from
have changed since it was estimated.
Re-run `rbx time -p boca` to refresh it.

It is a warning, not an error: whether the change mattered to the timing is your call.

Tuning an estimate by hand#

An estimate is the smallest limit the measurements allow. Sometimes you want a different one: a rounder number, or more headroom for a slow language. Setting it with rbx time -s custom throws away everything the estimate measured. Edit the profile instead:

rbx time -e -p boca

The editor needs a profile that rbx time estimated. It refuses a custom or inherited one, which doesn't record the measurements a check needs.

It lists the base limit and each language group of the profile. Move between them with Up and Down, and step a limit with Left and Right. R puts a row back to its estimate. Typing digits and pressing Enter sets an exact value. With nothing typed, Enter saves the profile and Q leaves without writing.

Below the list is the limits table rbx time prints, with a Check column that judges each limit against what the estimate measured: the range the group's solutions allow, and whether the limit you picked falls inside it. The time limit ratios set that range.

Check Meaning
the range, unmarked The limit fits every bound the estimate found.
⚠ thin margin The accepted solutions pass, but with less headroom than acToTimeLimit asks for.
✗ AC fails An accepted solution needs more time than the limit gives it.
✗ slow passes A solution expected to be too slow finishes within the limit times timeLimitToTle.
? 2 unverified You raised the limit, and this many slow solutions were only seen still running for less than the new limit times timeLimitToTle.

Each check is arithmetic over what the estimate recorded, and the editor runs nothing. A ✗ or a ⚠ is already measured, so the fix is a different limit. A ? isn't measured: nothing says whether those slow solutions still time out. Run the solutions against the profile to settle it:

rbx run -p boca

Under the limits table, a second one lists every solution of the selected row with its measured time and the bound it sets on the limit. An accepted solution sets a minimum, and a slow one a maximum. Step the limit and watch which solution's check changes.

A profile estimated before rbx recorded these timings shows a hint instead. Run rbx time on it again before you edit it to fill them in, since a new estimate replaces any limit you set by hand.

A profile with a runs list adds a section under from rbx time --run-all, with one row per solution showing its expected outcome, verdict and slowest time next to the limit it ran at. Since the editor never judges those rows again, stepping away from that limit turns the row's at N ms yellow and adds a ⚠.

The profile keeps the estimate next to your limit. Every later limits table marks that row as set by hand next to the estimate it replaced, and keeps the Check column.

To try an edit without saving it, add --dry, as in Rehearsing without writing:

rbx time -e -p boca --dry

In VS Code

The [rbx](){:.rbx} extension shows the same checks on a page, where you can drag a limit and watch each solution's status change.

Inheriting from the package#

Some targets do not need limits of their own — they should use whatever problem.rbx.yml says. Create a profile that inherits:

rbx time --strategy=inherit -p polygon

That writes a .limits/polygon.yml containing inheritFromPackage: true, and it keeps reflecting the package's limits as they change.

Integrating a profile into the package#

The other direction: you estimated limits you are happy with, and now you want them to be the package's limits.

rbx time --integrate -p local

This copies the time, memory and output limits and any modifiers from the profile into problem.rbx.yml.

Scaling every limit locally#

RBX_TIME_MULTIPLIER multiplies every effective time limit, without editing a profile:

RBX_TIME_MULTIPLIER=1.5 rbx run

Reach for it when you are working on hardware slower than the one the profile was measured on and you want your solutions judged fairly anyway. It changes nothing on disk, so it will not follow you into a package.