← All problemsSign in

Planting Trees

CodeChefRating 1656Open on judge ↗

Kerim is an environment-friendly guy. Today, he accepted Samir's challenge of planting 20 million trees by 2020. Currently, there are $N$ trees (numbered $1$ through $N$) planted at distinct positions on a line; for each valid $i$, the position of the $i$-th tree is $A_i$. A set of trees is *beautiful* if for each tree in this set (let's denote its position by $x$), there is a tree at the posit

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start