Cod sursa(job #1349552)

Utilizator varga13VarGaz13 varga13 Data 20 februarie 2015 12:06:31
Problema A+B Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 1.42 kb
#include <fstream>
#include <iostream>
#include <vector>
#include <utility>
#include <stack>
#define mp(a,b) make_pair(a,b)
#define mx 1000000
//de lene pentru lemne
using namespace std;

ifstream f("maxflow.in");
ofstream g("maxflow.out");

int m,n;
vector< pair<int,int> > G[mx];// fisrt = nnod||second=flow
vector< pair<int,int> > GR[mx];
bool been[mx];
int ant[mx];

bool BFS(int source, int sink)//returns if there is a path from start to end
{
    stack<int> S;

    for(int i=1;i<=n;i++)
    {
        been[i]=false;
        ant[i]=-1;
    }

    for(S.push(source);S.size();)
    {
        int actual=S.top();
        S.pop();
        if(actual==sink)
        {
            return true;
        }

        for(int i=0;i<G[actual].size();i++)
        {
            if(!been[G[actual][i].first] )/*&& G[actual][i].second>=0)*/
            {
                cout<<actual<<' '<<G[actual][i].first<<'\n';
                been[G[actual][i].first]=true;
                ant[G[actual][i].first]=actual;
                S.push(G[actual][i].first);
            }
        }
    }
return false;
}

void GetMin()
{

}

void Augment()
{

}

void Edmonds()
{

}

void Read()
{
    f>>n>>m;
    for(int i=0;i<m;i++)
    {
        int from, to, flow;
        f>>from>>to>>flow;
        G[from].push_back( mp(to,flow) );

    }

}

int main()
{
    Read();

    return 0;
}