← All problemsSign in

Build Towers

CodeChefRating 2688Open on judge ↗

There are $N$ cities connected by roads such that they form a tree-like structure. Your task is to build exactly $A_i$ towers in $i^{th}$ city. One or multiple towers can be built in a city only if there is a brick factory present in that city. Currently, only city $1$ has a brick factory. To complete the project, you can do the following two types of operations: - Type $1$: Construct a tower

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