CompetitiveProgramming

This documentation is automatically generated by online-judge-tools/verification-helper

View the Project on GitHub null0124/CompetitiveProgramming

:x: warshallfloyd
(kyopro/library/graph/warshallfloyd.cpp)

Verified with

Code

/*
* @title warshallfloyd
* @docs kyopro/docs/warshallfloyd.md
*/

//ワーシャルフロイド
void WarshallFloyd(int n, vector<vector<ll>> & d) {
	rep(i, n) {//経由する頂点
		rep(j, n) {//始点
			rep(k, n) {//終点
				d[j][k] = min(d[j][k], d[j][i] + d[i][k]);
			}
		}
	}
}
#line 1 "kyopro/library/graph/warshallfloyd.cpp"
/*
* @title warshallfloyd
* @docs kyopro/docs/warshallfloyd.md
*/

//ワーシャルフロイド
void WarshallFloyd(int n, vector<vector<ll>> & d) {
	rep(i, n) {//経由する頂点
		rep(j, n) {//始点
			rep(k, n) {//終点
				d[j][k] = min(d[j][k], d[j][i] + d[i][k]);
			}
		}
	}
}
Back to top page