hiho week 119 register

Ended

Participants:2176

Verdict:Accepted
Score:100 / 100
Submitted:2016-10-08 22:59:32

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 <cstring>
#include <deque>
#include <vector>
#include <limits.h>
using namespace std;
#define MAX_SIZE 200000
int head[MAX_SIZE];
struct edge{
    int to;
    int next;
    int f;//left flow
} e[MAX_SIZE];
int level[MAX_SIZE];
//head[i] point to the first edge whose tail is vertex i
void addEdge(int u,int v,int f)
{
    static int p=0;
    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++;
}
bool bfs(int s,int t)
{   
    memset(level,0,sizeof(level));
    deque<int> q;
    q.push_back(s);
    level[s]=1;
    while(!q.empty())
    {
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX