Skip to content

Commit db679fc

Browse files
committed
add std
1 parent 2141213 commit db679fc

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

include/graph/bellman_ford.hpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
#pragma once
2+
#include <queue>
3+
#include <vector>
24

35
template <typename T> struct BellmanFord {
46
private:
5-
static constexpr T INF = numeric_limits<T>::max() / 2 - 1;
7+
static constexpr T INF = std::numeric_limits<T>::max() / 2 - 1;
68

79
struct Edge {
810
int to;
911
T cost;
1012
};
1113

1214
int n;
13-
vector<vector<Edge>> G;
14-
vector<T> dist;
15+
std::vector<std::vector<Edge>> G;
16+
std::vector<T> dist;
1517

1618
public:
1719
explicit BellmanFord(int n) : n(n), G(n), dist(n, INF) {}
@@ -52,8 +54,8 @@ template <typename T> struct BellmanFord {
5254
}
5355
// 負閉路をBFSで伝播させる
5456
void spread_neg_cycles() {
55-
queue<int> q;
56-
vector<bool> used(n, false);
57+
std::queue<int> q;
58+
std::vector<bool> used(n, false);
5759
for (int i = 0; i < n; ++i) {
5860
if (dist[i] == -INF) {
5961
used[i] = true;

0 commit comments

Comments
 (0)