Skip to main content

AtCoder · AHC057

Molecules

Schedule bonds among moving points on a toroidal plane and finish with ten equal-size components at minimum distance cost.

01

Task

Each Case begins with 300 independently moving points on a 100,000 × 100,000 torus. The Policy may add bonds before each simultaneous movement phase.

A bond joins two different connected components, incurs rounded toroidal distance cost, and combines component velocity through momentum conservation. At turn 1,000 the graph must contain exactly ten components of 30 points.

02

Policy interface

Every observation contains the complete public moving system. The first observation also includes the fixed task constants.

Observation fieldMeaning
turn / turns_remainingCurrent temporal state
positions300 × 2 point positions
velocities300 × 2 component velocities
components / component_countCanonical component labels and current count
total_cost / initialAccumulated cost and first-observation task constants

Return all bonds for the current turn as one atomic set. An empty set advances the point system without bonding.

ActionMeaning
{"bonds": [[point_i, point_j], ...]}Join pairs from different current components
{"bonds": []}Advance without bonding
03

Evaluation

QuantityDefinition
CompletionExactly 10 components of 30 points after 1,000 turns
Benchmark scoreMean official logarithmic distance-cost score
Policy failureContributes 0
04

Feedback

Feedback reports score, total bond cost, completion, failures, and bounded bond-event coverage.

FieldMeaning
mean_log_cost_scorePrimary Benchmark score
mean_total_costMean completed-solution bond cost
completed / policy_failuresEpisode outcome counts
bond_events / bond_events_omittedPublished and omitted trace event counts
trace.jsonlInitial public point state plus a bounded sequence of bond events and resulting component state.
05

Using the distribution

Build this independently installable leaf project from the repository root:

uv sync --project environments/atcoder/ahc057/molecules --extra dev
uv build environments/atcoder/ahc057/molecules

The package exports:

from molecules import MoleculesBenchmark, baseline_program

benchmark = MoleculesBenchmark()
program = baseline_program()