hiho week 117 register

Ended

Participants:659

Verdict:Accepted
Score:100 / 100
Submitted:2016-09-27 01:55:42

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<bits/stdc++.h>
using namespace std;
const int maxN = 205;
const int None = 0x3f3f3f3f;
const int inf = 0x3f3f3f3f;
bool visited[maxN];
int parent[maxN], cur[maxN];
int n, m, edge[maxN][maxN], s, t, total;
vector<int> nb[maxN];
int find(){
    memset(visited, 0, sizeof(visited));
    memset(parent, 0x3f, sizeof(parent));
    memset(cur, 0, sizeof(cur));
    cur[s] = inf;
    queue<int> Q;
    Q.push(s);
    visited[s] = true;
    while(!Q.empty()){
        int u = Q.front();
        Q.pop();
        //for(int i = 0; i < maxN; i++){
        for(auto i : nb[u]){
            // cur[u] must be non zero
            if(edge[u][i] && !visited[i]){
                cur[i] = min(cur[u], edge[u][i]);
                parent[i] = u;
                if(i == t)
                    break;
                Q.push(i);
                visited[i] = true;
            }
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX