Yet to decide the Name
CodeChefOpen on judge ↗
There are $N$ adjacent cities $1$ to $N$ out of which only $H$ cities have hospitals. it takes unit time to go from one city to another. You have to answer Q queries. In each query, there is an emergency in a city $k$. Find the least time required to reach the nearest hospital. ###Input: - First line will contain N,Q and H. - Second line contains H numbers, The cities having a hospital. -
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