Two Kings and Their Estate
CodeChefOpen on judge ↗
There are two kings George and Alex quarreling over a precious state of $N$ lands connected by $N-1$ roads. There are $a$i gold coins in the $i$th land. Both of them want to win such a precious state. In order to win this state, they decided to play a game as follows. There is a genie who knows the state very well and he is the one who can collect gold coins from any land of the state. But he can
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