Sarkari Karyalay
CodeChefOpen on judge ↗
A country has $N$ cities connected to each other with $M$ roads, like a graph with bidirectional weighted edges such that it is always possible to travel from one of the cities to other. There are $K$ government offices all located in different cities. $i^{th}$ office is located in the city $a_i$ and has $b_i$ employees. There is a restriction that each office should have at least $1$ employee.
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