This documentation is automatically generated by online-judge-tools/verification-helper
#include "C++/graph/ShortestPath.hpp"
#pragma once
#pragma GCC diagnostic ignored "-Wreorder"
#include <vector>
#include <algorithm>
namespace man {
struct ShortestPath {
private:
const std::vector<long long> cost;
const std::vector<int> src;
public:
ShortestPath(const std::vector<long long> &cost, const std::vector<int> &src): cost(cost), src(src){}
inline bool is_thru(const int i) const noexcept { return src[i] != -1; }
inline std::vector<int> path(int i) noexcept {
std::vector<int> ret;
for(; i != -1; i = src[i]) {
ret.emplace_back(i);
}
std::ranges::reverse(ret);
return ret;
}
inline std::vector<long long> get() const noexcept { return cost; }
};
}
/**
* @brief 最短路
*/
#line 2 "C++/graph/ShortestPath.hpp"
#pragma GCC diagnostic ignored "-Wreorder"
#include <vector>
#include <algorithm>
namespace man {
struct ShortestPath {
private:
const std::vector<long long> cost;
const std::vector<int> src;
public:
ShortestPath(const std::vector<long long> &cost, const std::vector<int> &src): cost(cost), src(src){}
inline bool is_thru(const int i) const noexcept { return src[i] != -1; }
inline std::vector<int> path(int i) noexcept {
std::vector<int> ret;
for(; i != -1; i = src[i]) {
ret.emplace_back(i);
}
std::ranges::reverse(ret);
return ret;
}
inline std::vector<long long> get() const noexcept { return cost; }
};
}
/**
* @brief 最短路
*/