leetcode/3341/3341.cpp
2025-05-21 14:26:13 +03:00

72 lines
1.5 KiB
C++

#include <vector>
#include <queue>
#include <set>
namespace {
struct Coord {
size_t x, y;
explicit constexpr Coord(size_t x_, size_t y_)
: x(x_), y(y_)
{}
bool operator == (const Coord& other) const {
return std::tuple(x, y) == std::tuple(other.x, other.y);
}
};
struct Node : public Coord {
size_t g, h;
size_t f;
Node* parent;
explicit constexpr Node(size_t x_, size_t y_)
: Coord(x_, y_)
{}
explicit constexpr Node(const Coord& coord)
: Coord(coord.x, coord.y)
{}
int operator < (const Node& other) const {
return f < other.f;
}
bool operator == (const Node& other) const {
return Coord::operator==(other);
}
};
}
class Solution3341 {
public:
int minTimeToReach(std::vector<std::vector<int>>& moveTime) {
constexpr Coord start{0, 0};
const Coord end{moveTime.size(), moveTime[0].size()};
auto start_node = Node(start);
auto end_node = Node(end);
std::priority_queue<Node> open_list;
open_list.push(start_node);
std::set<Node> closed_set;
while (open_list.size())
{
Node current_node = open_list.top();
open_list.pop();
if (current_node == end_node) {
std::vector<Coord> path;
// while (current_node)
}
}
return 0;
}
};