Nearest Strong City
CodeChefOpen on judge ↗
During world war $1$, there were $N$ cities and $M$ roads connecting cities in a country. Each $j^{th}$ road in the country is of particular distance $D_j$ and each $i^{th}$ city has population $A_i$. There was a secret message of the enemy intercepted which tells that enemy is going to attack the roads of the country. If an enemy attacks a particular road then that road becomes unusable. Let us
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