hiho week 115 register

Ended

Participants:333

Verdict:Accepted
Score:100 / 100
Submitted:2016-09-17 00:11:49

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<cstdio>
#include<cmath>
#include<cstring>
#include<queue>
using namespace std;
int m,n,ans;
struct edge
{
    int to,next,f;
}e[200005];
int head[20005],p;
void addedge(int u,int v,int f)
{
    e[p].to=v;e[p].f=f;e[p].next=head[u];head[u]=p;p++;
    e[p].to=u;e[p].f=0;e[p].next=head[v];head[v]=p;p++;
}
int level[20005];
bool bfs(int s,int t)
{
    memset(level,0,sizeof(level));
    queue<int> q;q.push(s);level[s]=1;
    while(!q.empty())
    {
        int u=q.front();q.pop();
        if(t==u)return 1;
        for(int i=head[u];i!=-1;i=e[i].next)
        {
            int v=e[i].to,f=e[i].f;
            if(level[v]==0&&f!=0)q.push(v),level[v]=level[u]+1;
        }
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX