← CSES Better

Accumulate Minimum Stone Weights as Relations Arrive

ZIO · 2023 · Zonal Informatics Olympiad · P4

Open official problem ↗
Ask AI

Open a hint-first prompt in a new AI chat. Grok may ask you to confirm before sending.

Open Claude Desktop

graphs · constraints · incremental-processing

The organizer’s problem statement is available at the official source link.

difference constraints

Add one weight relation at a time

Each new relation constrains a positive integer weight difference, while all earlier relations stay active. Schematic structure only; vertices and edges represent the task relation, not an official sample. Schematic graph only; labels and edges show the task relation, not an official sample.

wA-wB = XrelationStone AStone BStone C
  1. 1

    Add a relation

    Add the next signed relation to the growing constraint graph.
  2. 2

    Minimize positive weights

    Find a positive assignment satisfying the full prefix with minimum total weight.
  3. 3

    Accumulate prefix totals

    Sum those minimum totals over every prefix of added relations.
Tools
1
2
3
4
5
6
7
8
9
10
11
12
Draft saved locally
|12 lines, 156 chars

Run output

Run your code to see output.