Submission #1000782

# Submission time Handle Problem Language Result Execution time Memory
1000782 2024-06-18T08:40:21 Z nomuluun Race (IOI11_race) C++14
21 / 100
3000 ms 11640 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
bool vis[200005]={0};
vector<pair<int,int>>v[200005];
ll mi=INT_MAX;
void dfs(int q, int dis, int hi, int ka){
    int m=v[q].size();
    if(dis==ka){
        if(hi<mi)mi=hi;
    }
    for(int i=0; i<m; i++){
        int k=v[q][i].first;
        ll cost=v[q][i].second;
        if(!vis[k]){
            vis[k]=1;
            dfs(k,dis+cost,hi+1,ka);
        }
    }
}
int best_path(int N, int K, int H[][2], int L[]){
    for(int i=0; i<N-1; i++){
        v[H[i][0]].push_back({H[i][1], L[i]});
        v[H[i][1]].push_back({H[i][0], L[i]});
    }
    for(int i=0; i<=N-1; i++){
        for(int i=0; i<N; i++){
            vis[i]=0;
        }
        vis[i]=1;
        dfs(i,0,0,K); //ehleh oroi distance highway
    }
    if(mi==INT_MAX)return -1;
    else return mi;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 6748 KB Output is correct
2 Correct 2 ms 4956 KB Output is correct
3 Correct 2 ms 4956 KB Output is correct
4 Correct 2 ms 4956 KB Output is correct
5 Correct 2 ms 4956 KB Output is correct
6 Correct 2 ms 4956 KB Output is correct
7 Correct 2 ms 4956 KB Output is correct
8 Correct 2 ms 4972 KB Output is correct
9 Correct 2 ms 5112 KB Output is correct
10 Correct 2 ms 7000 KB Output is correct
11 Correct 2 ms 4956 KB Output is correct
12 Correct 2 ms 4956 KB Output is correct
13 Correct 2 ms 4956 KB Output is correct
14 Correct 2 ms 4956 KB Output is correct
15 Correct 2 ms 4956 KB Output is correct
16 Correct 2 ms 4956 KB Output is correct
17 Correct 2 ms 4956 KB Output is correct
18 Correct 2 ms 4956 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 6748 KB Output is correct
2 Correct 2 ms 4956 KB Output is correct
3 Correct 2 ms 4956 KB Output is correct
4 Correct 2 ms 4956 KB Output is correct
5 Correct 2 ms 4956 KB Output is correct
6 Correct 2 ms 4956 KB Output is correct
7 Correct 2 ms 4956 KB Output is correct
8 Correct 2 ms 4972 KB Output is correct
9 Correct 2 ms 5112 KB Output is correct
10 Correct 2 ms 7000 KB Output is correct
11 Correct 2 ms 4956 KB Output is correct
12 Correct 2 ms 4956 KB Output is correct
13 Correct 2 ms 4956 KB Output is correct
14 Correct 2 ms 4956 KB Output is correct
15 Correct 2 ms 4956 KB Output is correct
16 Correct 2 ms 4956 KB Output is correct
17 Correct 2 ms 4956 KB Output is correct
18 Correct 2 ms 4956 KB Output is correct
19 Correct 2 ms 4956 KB Output is correct
20 Correct 2 ms 4956 KB Output is correct
21 Correct 9 ms 4956 KB Output is correct
22 Correct 9 ms 4952 KB Output is correct
23 Correct 9 ms 4956 KB Output is correct
24 Correct 8 ms 5200 KB Output is correct
25 Correct 9 ms 5200 KB Output is correct
26 Correct 9 ms 5208 KB Output is correct
27 Correct 9 ms 5200 KB Output is correct
28 Correct 9 ms 4952 KB Output is correct
29 Correct 8 ms 4956 KB Output is correct
30 Correct 9 ms 6792 KB Output is correct
31 Correct 8 ms 6748 KB Output is correct
32 Correct 9 ms 4952 KB Output is correct
33 Correct 10 ms 4956 KB Output is correct
34 Correct 9 ms 5216 KB Output is correct
35 Correct 9 ms 5220 KB Output is correct
36 Correct 8 ms 5224 KB Output is correct
37 Correct 8 ms 6748 KB Output is correct
38 Correct 10 ms 6748 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 6748 KB Output is correct
2 Correct 2 ms 4956 KB Output is correct
3 Correct 2 ms 4956 KB Output is correct
4 Correct 2 ms 4956 KB Output is correct
5 Correct 2 ms 4956 KB Output is correct
6 Correct 2 ms 4956 KB Output is correct
7 Correct 2 ms 4956 KB Output is correct
8 Correct 2 ms 4972 KB Output is correct
9 Correct 2 ms 5112 KB Output is correct
10 Correct 2 ms 7000 KB Output is correct
11 Correct 2 ms 4956 KB Output is correct
12 Correct 2 ms 4956 KB Output is correct
13 Correct 2 ms 4956 KB Output is correct
14 Correct 2 ms 4956 KB Output is correct
15 Correct 2 ms 4956 KB Output is correct
16 Correct 2 ms 4956 KB Output is correct
17 Correct 2 ms 4956 KB Output is correct
18 Correct 2 ms 4956 KB Output is correct
19 Execution timed out 3084 ms 11640 KB Time limit exceeded
20 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 6748 KB Output is correct
2 Correct 2 ms 4956 KB Output is correct
3 Correct 2 ms 4956 KB Output is correct
4 Correct 2 ms 4956 KB Output is correct
5 Correct 2 ms 4956 KB Output is correct
6 Correct 2 ms 4956 KB Output is correct
7 Correct 2 ms 4956 KB Output is correct
8 Correct 2 ms 4972 KB Output is correct
9 Correct 2 ms 5112 KB Output is correct
10 Correct 2 ms 7000 KB Output is correct
11 Correct 2 ms 4956 KB Output is correct
12 Correct 2 ms 4956 KB Output is correct
13 Correct 2 ms 4956 KB Output is correct
14 Correct 2 ms 4956 KB Output is correct
15 Correct 2 ms 4956 KB Output is correct
16 Correct 2 ms 4956 KB Output is correct
17 Correct 2 ms 4956 KB Output is correct
18 Correct 2 ms 4956 KB Output is correct
19 Correct 2 ms 4956 KB Output is correct
20 Correct 2 ms 4956 KB Output is correct
21 Correct 9 ms 4956 KB Output is correct
22 Correct 9 ms 4952 KB Output is correct
23 Correct 9 ms 4956 KB Output is correct
24 Correct 8 ms 5200 KB Output is correct
25 Correct 9 ms 5200 KB Output is correct
26 Correct 9 ms 5208 KB Output is correct
27 Correct 9 ms 5200 KB Output is correct
28 Correct 9 ms 4952 KB Output is correct
29 Correct 8 ms 4956 KB Output is correct
30 Correct 9 ms 6792 KB Output is correct
31 Correct 8 ms 6748 KB Output is correct
32 Correct 9 ms 4952 KB Output is correct
33 Correct 10 ms 4956 KB Output is correct
34 Correct 9 ms 5216 KB Output is correct
35 Correct 9 ms 5220 KB Output is correct
36 Correct 8 ms 5224 KB Output is correct
37 Correct 8 ms 6748 KB Output is correct
38 Correct 10 ms 6748 KB Output is correct
39 Execution timed out 3084 ms 11640 KB Time limit exceeded
40 Halted 0 ms 0 KB -