Skip to content

Shortest Path In A Grid With Obstacles Elimination - #157

Open
tom4649 wants to merge 2 commits into
mainfrom
1293.Shortest-Path-in-a-Grid-with-Obstacles-Elimination
Open

Shortest Path In A Grid With Obstacles Elimination#157
tom4649 wants to merge 2 commits into
mainfrom
1293.Shortest-Path-in-a-Grid-with-Obstacles-Elimination

Conversation

@tom4649

@tom4649 tom4649 commented Aug 10, 2026

Copy link
Copy Markdown
Owner

step = (ii, jj, k-grid[ii][jj], s+1)
if step[0:3] not in seen:
seen.add(step[0:3])
dq.append(step)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

これ、ここまでの破壊回数が1で到達できたならば、破壊回数が2では調べる必要はないのではないでしょうか。

私はこれはダイクストラに破壊回数がついていて、到達時間と破壊回数でパレート最適なのだけ残すというイメージです。

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dequeを使ったBFS実装も書いてみました。辺コスト1なのでダイクストラと同等です。破壊回数最大だけを残すのはパレート最適といえますね。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants