Добавил:
t.me Прошиваю/настраиваю роутеры в общаге МИЭТ, пишите в тг: t.me/aogudugnp Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

аисд / lab4 / Node

.h
Скачиваний:
0
Добавлен:
17.08.2025
Размер:
1.64 Кб
Скачать
#include <iostream>
#include <vector>

enum Limits : unsigned int {
	// INF = (unsigned)(-1) / 2 - 1,
	INF = 10000,
};


struct Node
{
	Node() = default;
	Node(const std::vector<std::vector<int>>& i_matrix,
		const std::vector<int>& i_matrixRealRows,
		const std::vector<int>& i_matrixRealCols,
		const std::vector<std::pair<int, int>>& i_path,
		const int& i_lowerBound,
		const int& i_pathLen);

	Node(const Node& other);
	~Node() = default;

	std::vector<std::vector<int>> matrix;
	std::vector<int> matrixRealRows;
	std::vector<int> matrixRealCols;
	std::vector<std::pair<int, int>> path;

	int lowerBound;
	int pathLen;
};

Node::Node(const std::vector<std::vector<int>>& i_matrix,
	const std::vector<int>& i_matrixRealRows,
	const std::vector<int>& i_matrixRealCols,
	const std::vector<std::pair<int, int>>& i_path,
	const int& i_lowerBound, const int& i_pathLen)
{
	int len = i_matrix.size();
	matrix.resize(len);
	for (int i = 0; i < len; i++)
	{
		matrix[i].reserve(len);
		for (int j = 0; j < len; j++)
			matrix[i].push_back(i_matrix[i][j]);
	}

	matrixRealRows = i_matrixRealRows;
	matrixRealCols = i_matrixRealCols;

	for (auto& it : i_path)
		path.push_back(it);

	lowerBound = i_lowerBound;
	pathLen = i_pathLen;
}

Node::Node(const Node& other)
{
	matrix.resize(other.matrix.size());
	for (int i = 0; i < other.matrix.size(); i++)
	{
		for (int j = 0; j < other.matrix[i].size(); j++)
			matrix[i].push_back(other.matrix[i][j]);
	}

	matrixRealRows = other.matrixRealRows;
	matrixRealCols = other.matrixRealCols;

	for (auto& it : other.path)
		path.push_back(it);


	lowerBound = other.lowerBound;
	pathLen = other.pathLen;
}
Соседние файлы в папке lab4