← All problemsSign in

Team Games

OJ is currently the mayor of a city harboring N citizens, and there exists a tree like relation structure between them, i.e. OJ has N-1 relations of type U V where there exist relation between U and V (undirected edge between U and V). Each citizen of the town has certain strength to them which is stored in an array A. OJ wants to conduct some games for his entertainment. For the

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