REE / tasks /ball_sorting_arena /instruction.md
zzqsb's picture
Release the REE tasks and dataset card.
7f50cd1
|
Raw History Blame Contribute Delete
4.54 kB

Ball sorting arena

Goal

The arena coordinator gives you colored balls stacked on poles. Write a general method that the coordinator can run to move balls between poles until every color is together on one full pole. The coordinator accepts only legal moves and prefers a shorter complete sequence. The final assignment of colors to pole indices is free.

What You Have

path what is in it
/app/methods/main/ your submission; it starts as the pairwise-selection starter, and run.sh is its entry point
/app/core/ the shared reader and metric; CORE_DIR=/app/core is set
/app/data/ the practice instances' inputs
/app/selfcheck.py the rehearsal program

In the files, sequences are poles and integer labels are colors. The coordinator supplies the practice inputs under /app/data/<id>/, with one subdirectory per instance. Each state.txt starts with n m, followed by n rows of m integer labels in bottom-to-top order; the rightmost entry is the top. The coordinator supplies labels in 1..n, each occurring m times. The coordinator leaves sequence n+1 empty and initially fills the first n sequences; every sequence has capacity m. The input is a balanced multiset, not a list of precomputed answers. The generator permits label_count from 24 through 32 and capacity from 24 through 40.

input term meaning
n number of initially full sequences and distinct labels
m capacity of every sequence and multiplicity of each label
state.txt the complete stack state, with each row in bottom-to-top order

What You Submit

Place a general method in /app/methods/main/ and make its entry run.sh <data dir> <output dir>. It must read state.txt from the read-only data directory and write moves.txt to the output directory. The grading service carries only /app/methods/main/ into a clean container with the same core runtime and /app/core/; no other session files travel with it. The service runs the method as an unprivileged account, the same one used by the rehearsal. If you provide /app/methods/main/build.sh, the service runs it once offline within 900 seconds; a failed build gives every graded instance the failure cost.

The coordinator requires whitespace-separated integers in the output: k followed by exactly k pairs x y. The count must satisfy 0 <= k <= 2000000; each pair uses indices in 1..n+1 and has x != y. The validator requires canonical decimal integers with no plus sign or leading zero. The move steward removes the top entry from x and appends it to y; x must be nonempty and y must have free capacity before the move. The coordinator accepts a complete result only when every label is together on one full sequence, with one empty sequence. The service rejects missing, malformed, illegal, incomplete, oversized, or late output.

Feasibility Before Cost

The move validator rejects any sequence that violates a hard legality rule, regardless of its move count. A valid complete output has cost k + 1; lower is better. The failure cost is 2000002.

Budget

The service gives each instance 60 seconds through TASK_BUDGET_SEC; a timeout or surviving child process is rejected. The service requires regular text output files of at most 64 MB. The session has 4 CPUs and 16 GB of memory for 12 hours with no network access. Grading uses 4 CPUs and 8 GB of memory with no network access.

The session and grading each have 10 GB of storage.

How It Is Judged

The metric simulates your moves and scores each valid instance by k + 1; lower is better. An invalid or failed instance receives the failure cost 2000002. The service grades 88 sealed instances. The service calls your method once per sealed instance. The sealed inputs are available only in the grading container. This task uses no external answer files: the validator checks the path itself. The service combines per-instance costs into one score by the geometric mean, exp(mean(log(cost))), including failure costs. The metric's improving bound is 1.

Self-check

Run:

python3 /app/selfcheck.py rehearse

The coordinator's rehearsal runs your method on every practice instance under the grading conditions and prints a final {"score": …} line. It is a smoke test for choosing a method, not the graded score. Use separate practice instances to compare changes and check that improvements generalize. The starter groups labels in pairs through a temporary workspace; you may replace it entirely.