Skip to content

Commit 7b6da1a

Browse files
authored
Update the-maze-iii.cpp
1 parent 6ca43eb commit 7b6da1a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

C++/the-maze-iii.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ class Solution {
66
string findShortestWay(vector<vector<int>>& maze, vector<int>& ball, vector<int>& hole) {
77
static const unordered_map<string, vector<int>> dirs = {{"u", {-1, 0}}, {"r", {0, 1}},
88
{"l", {0, -1}}, {"d", {1, 0}}};
9-
queue<node> heap;
9+
priority_queue<node, vector<node>, greater<node>> heap;
1010
unordered_set<int> visited;
1111
heap.emplace(0, make_pair("", ball));
1212

1313
while (!heap.empty()) {
1414
int dist = 0;
1515
string path;
1616
vector<int> node;
17-
tie(dist, lvalue(tie(path, node))) = heap.front();
17+
tie(dist, lvalue(tie(path, node))) = heap.top();
1818
heap.pop();
1919
if (visited.count(hash(maze, node))) {
2020
continue;

0 commit comments

Comments
 (0)