Multi source Dijkstra failure on squared Euclidean distance 
Разница между en1 и en2, 345 символ(ов) изменены
The problem statement is :
``` We are g
"G
iven a 2D grid with multiple source cells. F, we need to compute for every cell (x, y), we need to compute the minimum cost to any source, where the cost between two cells is defined as the squared Euclidean distance:↵
cost((x,y),(u,v))
= = (x-u)^2 + (y-v)^2 ↵
```
."↵

I am interested in 
the reasonunderstanding why dDijkstra would fail suchfails for this task if Iwe start propagation from all source nodes, while keeping only the best_source[x][y] (nearest node to cell{x , y}) for each visited cell.↵

I understand that the issue is related to the non-linearity of the cost function, but I don’t have a strong intuition for why exactly Dijkstra fails here.this approach is incorrect.↵

What are 
some good ideasways to think about or models to easily get why it fails?↵
also, any instances of this problem
his behavior?↵

Also, if there are known problems (e.g., on Codeforces or AtCoder) that involve similar ideas, I
 would be appreciated references.

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский Mahmoud-Hossam 2026-05-04 17:59:55 345
en1 Английский Mahmoud-Hossam 2026-05-02 16:52:46 770 Initial revision (published)