Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions content/graph/MinCostMaxFlow.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ struct MCMF {
void path(int s) {
fill(all(seen), 0);
fill(all(dist), INF);
par[s] = 0;
dist[s] = 0; ll di;

__gnu_pbds::priority_queue<pair<ll, int>> q;
Expand Down
35 changes: 35 additions & 0 deletions stress-tests/graph/MinCostMaxFlow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,42 @@ void testNeg() {
cout<<"Tests passed!"<<endl;
}

void testMultiSource() {
const int ITS = 100;
const int TRY = 15;

rep(it, 0, ITS) {
size_t lasti = ::i;
int N = rand() % 7 + 2;
int M = rand() % 17;
int S = 0, T = 1;
MCMF mcmf(N);
rep(im, 0, M) {
int i, j;
do {
i = rand() % N;
j = rand() % N;
} while(i == j);
int fl = rand() % 50;
int co = rand() % 30;
mcmf.addEdge(i, j, fl, co);
}
rep(test, 0, TRY) {
int S, T;
do {
S = rand() % N;
T = rand() % N;
} while(S == T);
mcmf.maxflow(S, T);
}
::i = lasti;
}
cout<<"Tests passed!"<<endl;
}

int main() {
testMatching();
testNeg();
testMultiSource();
return 0;
}