hiho week 119 register

Ended

Participants:2176

Verdict:Accepted
Score:100 / 100
Submitted:2016-10-09 16:18:34

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<cstdio>
#include<iostream>
#include<string.h>
#define maxn 555
#define INF 111111111
using namespace std;
int n,m,ans;
int f[maxn][maxn];
int dis[maxn],b[maxn],q[maxn];
int BFS(){
    int l=0, r=1;
    q[1] = 0;
    memset(dis, -1, sizeof(dis));
    dis[0] = 0;
    while (l<r){
        int j=q[++l];
        for (int i=1;i<=n+m+1;i++){
            if (dis[i]<0 && f[j][i]>0){
                dis[i] = dis[j] +1;
                q[++r] = i;
            }
        }
    }
    if (dis[m+n+1]>=0) return 1;
    else return 0;
}
int dfs(int x, int low){
    if (x==n+m+1) return low;
    int a;
    for (int i=1;i<=n+m+1;i++){
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX