SPOJ Total Flow WA!!!

wa

#1

Hey guys i am getting WA!!! coming plzz help me up!!
i have used for_fulkserson algo here…
#include
#include
#include
#include
using namespace std;
list l[200];
list v;
int cost[200][200];
int rgraph[200][200];
int max1=10000;
int parent[800]={0};
int max_flow=0;

bool bfs()
{ int g=‘A’;
v.push_back(g);
int visited[800]={0};
list::iterator it;
parent[‘A’]=-1;
//visited[‘A’]=1;
while(!v.empty())
{
int u=v.front();
v.pop_front();
visited=1;
// cout<<"u valus is "<<u<<endl;
for(it=l.begin();it!=l.end()&&rgraph[*it]>0&&visited[*it]==0;it++)
{
// cout<<"rgraph valus is “<<u<<” “<<*it<<” "<<rgraph[*it]<<endl;

        v.push_back(*it);
        parent[*it]=u;
       
    
        
    }    
    
}if(visited['Z']==1)return true;
else
return false;

}

int ford()
{
int i,j,k,u;

while(bfs())
{ int min=10000;
//cout<<“hey”;
for(u=‘Z’;u!=‘A’;u=parent)
{if(min>rgraph[parent])min=rgraph[parent];}
// cout<<"min value is "<<min<<endl;
for(u=‘Z’;u!=‘A’;u=parent)
{
rgraph[parent]-=min;
rgraph[parent]+=min;
}

max_flow+=min;

}

}

int main()
{
int n,a,b,c,i,j,k;

cin>>n;
char ch1,ch2;
for(i=1;i<=n;i++)
{
    cin>>ch1;
    cin>>ch2;
    cin>>c;
    a=ch1;
    b=ch2;
    l[a].push_back(b);
    cost[a]**=c;
    rgraph[a]**=c;
}
ford();

cout<<max_flow<<endl;

// system(“pause”);
}