Submission #60656

# Submission time Handle Problem Language Result Execution time Memory
60656 2018-07-24T13:28:36 Z theknife2001 Race (IOI11_race) C++17
21 / 100
3000 ms 12108 KB
#include "race.h"
#include <bits/stdc++.h>

using namespace std;
const int N=2e5+55;
vector < pair < int , int > > vec[N];

int b;

void df(int u , int p , int cnt , int c , int k)
{
    if(cnt==k)
    {
        b=min(b,c);
        return ;
    }
    if(cnt>k)
        return ;
    int v,x;
    for(auto a:vec[u])
    {
        v=a.first;
        x=a.second;
        if(v==p)
            continue ;
        df(v,u,cnt+x,c+1,k);
    }
}

int best_path(int n, int K, int H[][2], int L[])
{
    for(int i=0;i<n-1;i++)
    {
        vec[H[i][0]].push_back({H[i][1],L[i]});
        vec[H[i][1]].push_back({H[i][0],L[i]});
    }
    b=1e9+55;
    for(int i=0;i<n;i++)
    {
        df(i,-1,0,0,K);
    }
    if(b==1e9+55)
        return -1;
    return b;
}

# Verdict Execution time Memory Grader output
1 Correct 6 ms 4984 KB Output is correct
2 Correct 6 ms 5092 KB Output is correct
3 Correct 6 ms 5128 KB Output is correct
4 Correct 9 ms 5204 KB Output is correct
5 Correct 8 ms 5256 KB Output is correct
6 Correct 8 ms 5348 KB Output is correct
7 Correct 10 ms 5348 KB Output is correct
8 Correct 9 ms 5348 KB Output is correct
9 Correct 8 ms 5348 KB Output is correct
10 Correct 7 ms 5348 KB Output is correct
11 Correct 8 ms 5348 KB Output is correct
12 Correct 8 ms 5348 KB Output is correct
13 Correct 7 ms 5348 KB Output is correct
14 Correct 10 ms 5448 KB Output is correct
15 Correct 9 ms 5448 KB Output is correct
16 Correct 7 ms 5448 KB Output is correct
17 Correct 6 ms 5448 KB Output is correct
18 Correct 9 ms 5448 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 4984 KB Output is correct
2 Correct 6 ms 5092 KB Output is correct
3 Correct 6 ms 5128 KB Output is correct
4 Correct 9 ms 5204 KB Output is correct
5 Correct 8 ms 5256 KB Output is correct
6 Correct 8 ms 5348 KB Output is correct
7 Correct 10 ms 5348 KB Output is correct
8 Correct 9 ms 5348 KB Output is correct
9 Correct 8 ms 5348 KB Output is correct
10 Correct 7 ms 5348 KB Output is correct
11 Correct 8 ms 5348 KB Output is correct
12 Correct 8 ms 5348 KB Output is correct
13 Correct 7 ms 5348 KB Output is correct
14 Correct 10 ms 5448 KB Output is correct
15 Correct 9 ms 5448 KB Output is correct
16 Correct 7 ms 5448 KB Output is correct
17 Correct 6 ms 5448 KB Output is correct
18 Correct 9 ms 5448 KB Output is correct
19 Correct 10 ms 5512 KB Output is correct
20 Correct 9 ms 5512 KB Output is correct
21 Correct 18 ms 5632 KB Output is correct
22 Correct 9 ms 5644 KB Output is correct
23 Correct 9 ms 5676 KB Output is correct
24 Correct 12 ms 5788 KB Output is correct
25 Correct 19 ms 5868 KB Output is correct
26 Correct 8 ms 5868 KB Output is correct
27 Correct 8 ms 5868 KB Output is correct
28 Correct 12 ms 5868 KB Output is correct
29 Correct 16 ms 5948 KB Output is correct
30 Correct 18 ms 5948 KB Output is correct
31 Correct 18 ms 5948 KB Output is correct
32 Correct 23 ms 5948 KB Output is correct
33 Correct 21 ms 5948 KB Output is correct
34 Correct 8 ms 5948 KB Output is correct
35 Correct 12 ms 5948 KB Output is correct
36 Correct 7 ms 5948 KB Output is correct
37 Correct 19 ms 5948 KB Output is correct
38 Correct 18 ms 5948 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 4984 KB Output is correct
2 Correct 6 ms 5092 KB Output is correct
3 Correct 6 ms 5128 KB Output is correct
4 Correct 9 ms 5204 KB Output is correct
5 Correct 8 ms 5256 KB Output is correct
6 Correct 8 ms 5348 KB Output is correct
7 Correct 10 ms 5348 KB Output is correct
8 Correct 9 ms 5348 KB Output is correct
9 Correct 8 ms 5348 KB Output is correct
10 Correct 7 ms 5348 KB Output is correct
11 Correct 8 ms 5348 KB Output is correct
12 Correct 8 ms 5348 KB Output is correct
13 Correct 7 ms 5348 KB Output is correct
14 Correct 10 ms 5448 KB Output is correct
15 Correct 9 ms 5448 KB Output is correct
16 Correct 7 ms 5448 KB Output is correct
17 Correct 6 ms 5448 KB Output is correct
18 Correct 9 ms 5448 KB Output is correct
19 Execution timed out 3030 ms 12108 KB Time limit exceeded
20 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 4984 KB Output is correct
2 Correct 6 ms 5092 KB Output is correct
3 Correct 6 ms 5128 KB Output is correct
4 Correct 9 ms 5204 KB Output is correct
5 Correct 8 ms 5256 KB Output is correct
6 Correct 8 ms 5348 KB Output is correct
7 Correct 10 ms 5348 KB Output is correct
8 Correct 9 ms 5348 KB Output is correct
9 Correct 8 ms 5348 KB Output is correct
10 Correct 7 ms 5348 KB Output is correct
11 Correct 8 ms 5348 KB Output is correct
12 Correct 8 ms 5348 KB Output is correct
13 Correct 7 ms 5348 KB Output is correct
14 Correct 10 ms 5448 KB Output is correct
15 Correct 9 ms 5448 KB Output is correct
16 Correct 7 ms 5448 KB Output is correct
17 Correct 6 ms 5448 KB Output is correct
18 Correct 9 ms 5448 KB Output is correct
19 Correct 10 ms 5512 KB Output is correct
20 Correct 9 ms 5512 KB Output is correct
21 Correct 18 ms 5632 KB Output is correct
22 Correct 9 ms 5644 KB Output is correct
23 Correct 9 ms 5676 KB Output is correct
24 Correct 12 ms 5788 KB Output is correct
25 Correct 19 ms 5868 KB Output is correct
26 Correct 8 ms 5868 KB Output is correct
27 Correct 8 ms 5868 KB Output is correct
28 Correct 12 ms 5868 KB Output is correct
29 Correct 16 ms 5948 KB Output is correct
30 Correct 18 ms 5948 KB Output is correct
31 Correct 18 ms 5948 KB Output is correct
32 Correct 23 ms 5948 KB Output is correct
33 Correct 21 ms 5948 KB Output is correct
34 Correct 8 ms 5948 KB Output is correct
35 Correct 12 ms 5948 KB Output is correct
36 Correct 7 ms 5948 KB Output is correct
37 Correct 19 ms 5948 KB Output is correct
38 Correct 18 ms 5948 KB Output is correct
39 Execution timed out 3030 ms 12108 KB Time limit exceeded
40 Halted 0 ms 0 KB -