Tree Colouring (Hard)
**This is worth $100$ points in Division $1$ and $50$ points in Divisions $2$, $3$ and $4$.** You have a tree with $N$ nodes numbered $1$ to $N$. You want to assign each node a colour $C_i$ ($1 \le C_i \le N$) such that the following conditions hold: - Each colour $X$ appears either $0$ times or $\ge 2$ times. - Consider all possible pairs $(A, B)$ such that $1 \le A < B \le N$ and $C_A = C_B$
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.
Sign in to chat with the tutor and save your progress.
Sign in to start