hiho week 38 register

Ended

Participants:420

Verdict:Accepted
Score:100 / 100
Submitted:2015-03-23 22:00:12

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 <stdio.h>
#include <string.h>
struct Edge
{
    int value, to, next;
} edge[200001];
int head[10001], limited[10001], k, t, n, m, minw = 1000000, maxw = 0;
bool dfs(int pos, int count, int w)
{
    if (pos == t)
        return true;
    if (limited[pos] + count >= k)
        return false;
    limited[pos] = k - count;
    ++count;
    for (int i = head[pos]; i > 0; i = edge[i].next)
        if (edge[i].value <= w && (limited[edge[i].to] + count <= k) \
            && dfs(edge[i].to, count, w))
            return true;
    return false;
}
int main()
{
    int cnt = 1, from, to, w;
    scanf("%d%d%d%d", &n, &m, &k, &t);
    ++n;
    for (int i = 0; i < m; ++i)
    {
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX