From 09f655e7949c609fc9b162dea71b640548087c08 Mon Sep 17 00:00:00 2001 From: Marege Date: Tue, 17 Nov 2026 14:37:17 +0100 Subject: [PATCH] U10fix4 --- u10/najkratsia_cesta.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/u10/najkratsia_cesta.py b/u10/najkratsia_cesta.py index f9ef96d..2be2dde 100644 --- a/u10/najkratsia_cesta.py +++ b/u10/najkratsia_cesta.py @@ -26,4 +26,17 @@ def shortest_path(number_of_nodes, connections): if j in path[i]: continue + new_dist = dist[i] + length + new_path = path[i] + [j] + + bet = False + if dist[j] is None: + bet = True + elif new_dist < dist[j]: + bet = True + if bet: + dist[j] = new_dist + path[j] = new_path + change = True + return path[end]