CommonLounge Archive

Codeforces 321C: Ciel The Commander

May 15, 2017

Problem in short:

Given a tree consisting of N nodes (<= 10^5). Assign a letter (‘A’-‘Z’) to each node. For any 2 distinct nodes having the same letter, the path between them must contain at least one node assigned a smaller letter (A being the smallest letter).

Print a valid assignment or state that it’s impossible.

© 2016-2022. All rights reserved.