hiho week 116 register

Ended

Participants:819

Verdict:Accepted
Score:100 / 100
Submitted:2016-09-18 02:16:58

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