Блог пользователя im_115

Автор im_115, история, 3 года назад, По-английски

Problem link — 20C - Dijkstra?
Solution with custom comparator (give MLE) — 142440675
Solution without comparator (Accepted) — 142444892
The logic of both the solutions are same (Dijkstra). Only the implementation is different. Why does using a custom comparator give MLE?

  • Проголосовать: нравится
  • -9
  • Проголосовать: не нравится

»
3 года назад, # |
  Проголосовать: нравится +24 Проголосовать: не нравится

The comparator seems to be ok. The real issue is here: int curd = temp.F;. You forgot that the type should be ll, thus leading to overflow. What happened next, I do not know, but negative distances were definitely bad.