Skip to content

Commit c1725f2

Browse files
authored
fix: remove duplicate insertion to visited set (doocs#1907)
1 parent c12f418 commit c1725f2

File tree

3 files changed

+0
-3
lines changed

3 files changed

+0
-3
lines changed

solution/2600-2699/2662.Minimum Cost of a Path With Special Roads/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ class Solution:
9292
continue
9393
vis.add((x, y))
9494
ans = min(ans, d + dist(x, y, *target))
95-
vis.add((x, y))
9695
for x1, y1, x2, y2, cost in specialRoads:
9796
heappush(q, (d + dist(x, y, x1, y1) + cost, x2, y2))
9897
return ans

solution/2600-2699/2662.Minimum Cost of a Path With Special Roads/README_EN.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ class Solution:
8686
continue
8787
vis.add((x, y))
8888
ans = min(ans, d + dist(x, y, *target))
89-
vis.add((x, y))
9089
for x1, y1, x2, y2, cost in specialRoads:
9190
heappush(q, (d + dist(x, y, x1, y1) + cost, x2, y2))
9291
return ans

solution/2600-2699/2662.Minimum Cost of a Path With Special Roads/Solution.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ def dist(x1: int, y1: int, x2: int, y2: int) -> int:
1414
continue
1515
vis.add((x, y))
1616
ans = min(ans, d + dist(x, y, *target))
17-
vis.add((x, y))
1817
for x1, y1, x2, y2, cost in specialRoads:
1918
heappush(q, (d + dist(x, y, x1, y1) + cost, x2, y2))
2019
return ans

0 commit comments

Comments
 (0)