hiho week 117 register

Ended

Participants:659

Verdict:Accepted
Score:100 / 100
Submitted:2016-09-25 11:54:50

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<queue>
#include<string.h>
using namespace std;
int ma[210][210];
int a[210];
int path[210];
int findPath(int n)
{
    queue<int> q;
    q.push(0);
    memset(a, 0, sizeof(a));
    memset(path, 0, sizeof(path));
    a[0] = 2147483647;
    while (!q.empty())
    {
        int u = q.front();
        if (u == n) return a[n];
        q.pop();
        for (int v = 0; v <= n; v++)
        {
            if (!a[v] &&ma[u][v] > 0)
            {
                path[v] = u;
                a[v] = a[u] < ma[u][v] ? a[u] : ma[u][v];
                q.push(v);
            }
        }
    }
    return 0;
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX