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

Ordered union circuit workshop

Goal

The workshop coordinator supplies a permutation of integer ranks and requests for intervals of positions. Build a general method that constructs every requested subset while minimising the total number of nodes in a reusable union circuit. Each initial node contains the rank at its corresponding input position. The coordinator permits a new node to unite earlier nodes only when their rank envelopes are disjoint; earlier nodes remain available for reuse.

The workshop validator requires exact answers. Position order defines each requested subset, while rank order determines which unions are legal. These are different orders.

What You Have

Path Contents
/app/methods/main/ Your submission directory, initially the starter, with executable entry run.sh
/app/core/ Shared input readers and the metric; CORE_DIR=/app/core is set
/app/data/ Practice inputs, with an instance directory under each id
/app/selfcheck.py The practice rehearsal

The coordinator supplies instance.txt in each instance directory. It contains whitespace-separated decimal integers. Its first line is item_count request_count. The next line gives item_count ranks, a permutation of the integers from the first positive integer through item_count. Each remaining line is a request span_start span_end: inclusive, one-based position indices satisfying 1 <= span_start <= span_end <= item_count. There are exactly request_count request lines, in the order the method must answer them.

Each requested subset has cardinality at least 1. Its target_cardinality = span_end - span_start + 1. The validator derives the required subsets directly from the input; there are no separate answer files.

Complete illustrative files are available at /app/core/interface/examples/instance.txt and /app/core/interface/examples/construction.txt.

The starter uses rank blocks, precomputes induced position subsequences within each block, and joins block results for each request. Its source and the installed compiler are available for inspection; you may replace the starter completely. Resolve shared interface files through CORE_DIR.

What You Submit

Submit a general method in /app/methods/main/, with everything it needs kept in that directory. The grading service carries only this directory into a clean grading container containing the installed runtime and /app/core/. Files elsewhere in your session are not submission dependencies.

The grading service calls run.sh <data dir> <output dir> once per instance, as an unprivileged account. Read instance.txt from the supplied read-only data directory and write construction.txt in the supplied output directory.

If /app/methods/main/build.sh exists, the grading service runs it once offline before the instance calls, within 900 seconds. A failed build fails every instance. The installed runtime supports offline compilation with g++ -std=c++17; the supplied starter compiles its program when invoked.

The validator reads construction.txt as follows:

  • Begin with the integer total, counting both original singleton nodes and constructed nodes. The required bound is item_count <= total <= 2200000.
  • Follow with exactly total - item_count pairs of earlier node IDs. IDs are one-based; initial node i contains the rank at input position i. The first constructed node has ID item_count + 1, and IDs increase in file order.
  • Each pair defines a union of its operands, leaving both operands available. For operands A and B, the validator requires max(A) < min(B) or max(B) < min(A), where extrema refer to ranks. Both operand orders are accepted. Every operation must obey this rule, including unused operations.
  • End with exactly request_count root IDs in input request order. Each root must contain precisely the ranks at positions from span_start through span_end, with no omission, addition, or repetition. The validator rejects trailing tokens.

The grading service requires each output to be a regular text file of at most 64 MB.

Feasibility Before Cost

The validator assigns the failure score -1 to any invalid, missing, or unreadable construction, regardless of its claimed node count. It checks all dependencies, union legality, and exact root subsets before evaluating cost.

Budget

The grading service grants each instance call 60 seconds, communicated through TASK_BUDGET_SEC. Grading provides 4 CPUs and 8 GB of memory, with no network access. Keep your thread count within that allocation. The service kills a method that exceeds its deadline and any background process left after the entry point returns; either event fails the instance.

The session provides 4 CPUs, 16 GB of memory, and 12 hours, with no network access.

The session and grading each have 10 GB of storage.

How It Is Judged

For a valid construction, the validator computes score = 1 - total/2200000; higher is better. The grading service evaluates 84 sealed instances. It reports the arithmetic mean of their instance scores, in these same units. Each failed instance contributes the failure score already stated above; failed instances are never omitted from the mean.

Sealed inputs are available only in the grading container. The solver's container contains neither sealed inputs nor sealed answers.

Self-check

Run:

python3 /app/selfcheck.py rehearse

The rehearsal runs your current method on every practice instance using the grading service's runner, unprivileged account, time limit, metric, and arithmetic mean. Its last line is a JSON object of the form {"score": ...}. Use this practice smoke test to assess changes; its result is not the sealed score.