hiho week 117 register

Ended

Participants:659

Verdict:Accepted
Score:100 / 100
Submitted:2016-09-26 19:06:15

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
int maxinf = 1000;
void modifygraph(vector<vector<int> > &graph, vector<int> &path, int D, int flow){
    int m = D;
    while(m){
        int t = path[m];
        graph[t][m] -= flow;
        graph[m][t] += flow;
        m = t;
    }
    return;
}
int findAugmentPath(vector<vector<int> > &graph,int D){
    queue<int> q;
    q.push(0);
    vector<bool> visited(D+1, false);
    visited[0] = true;
    vector<int> capacity(D+1, maxinf);
    vector<int> path(D+1, 0);
    while(!q.empty()){
        int s = q.front();
        q.pop();
        if(s == D){
            modifygraph(graph, path, D, capacity[D]);
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX