← CSES Better

Bamboo Art

ZCO · 2016 · Zonal Computing Olympiad · ZCO16002

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

sorting · arithmetic-progression · frequency-counting

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

arithmetic progression

Pick a longest equally spaced set of lengths

Choose a subset of distinct shoot lengths that can be ordered with one constant positive difference.

x1 < x2 < ... < xqx(i+1) - x(i) = dmaximize q
  1. 1

    Use distinct lengths

    Every shoot length in the input is different.
  2. 2

    Choose a constant step

    An installation is an increasing arithmetic progression from the available lengths.
  3. 3

    Maximize its size

    Find the largest subset that forms such a progression.
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.