← CSES Better

Moving Intervals - ZCO 2018

ZCO · 2018 · Zonal Computing Olympiad · MOVINTRL

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

intervals · sweep-line · overlap

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

interval overlap

Shared cakes are interval overlaps

Two children conflict exactly when their closed intervals share a cake; one allowed edit may relocate one equal-length interval.

interval 1
0–3
interval 2
1–4
  1. 1

    Detect conflicts

    Sort interval endpoints and identify every overlapping pair.
  2. 2

    Try one relocation

    With no edit, any overlap means conflict.
  3. 3

    Check all intervals

    For one edit, test whether an interval of the same length can be placed in a free span without creating overlap.
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.