# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
92008 |
2019-01-01T00:57:12 Z |
easrui |
Race (IOI11_race) |
C++14 |
|
3000 ms |
11256 KB |
#include <bits/stdc++.h>
#include "race.h"
using namespace std;
const int MN = 2e5+5;
struct Edge{
int x,d;
Edge(int a, int b){
x = a;
d = b;
}
};
vector<Edge> T[MN];
int DFS(int i, int val, int dis, int r, int K){
if(dis==K) return val;
if(dis>K) return MN;
int res = MN;
for(auto it : T[i]){
//cout << i << ' ' << it.x << ' ' << r << '\n';
if(it.x==r) continue;
res = min(res,DFS(it.x,val+1,dis+it.d,i,K));
}
return res;
}
int best_path(int N, int K, int H[][2], int L[])
{
int ans = MN;
for(int i=0; i<N-1; i++){
T[H[i][0]].push_back(Edge(H[i][1],L[i]));
T[H[i][1]].push_back(Edge(H[i][0],L[i]));
}
for(int i=0; i<N; i++){
ans = min(ans,DFS(i,0,0,i,K));
}
if(ans==MN) ans = -1;
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
4984 KB |
Output is correct |
2 |
Correct |
5 ms |
4984 KB |
Output is correct |
3 |
Correct |
5 ms |
5084 KB |
Output is correct |
4 |
Correct |
5 ms |
5112 KB |
Output is correct |
5 |
Correct |
4 ms |
4988 KB |
Output is correct |
6 |
Correct |
5 ms |
4984 KB |
Output is correct |
7 |
Correct |
5 ms |
4984 KB |
Output is correct |
8 |
Correct |
5 ms |
4984 KB |
Output is correct |
9 |
Correct |
5 ms |
5112 KB |
Output is correct |
10 |
Correct |
5 ms |
5112 KB |
Output is correct |
11 |
Correct |
5 ms |
5112 KB |
Output is correct |
12 |
Correct |
6 ms |
5112 KB |
Output is correct |
13 |
Correct |
5 ms |
5112 KB |
Output is correct |
14 |
Correct |
5 ms |
4984 KB |
Output is correct |
15 |
Correct |
5 ms |
4984 KB |
Output is correct |
16 |
Correct |
5 ms |
4984 KB |
Output is correct |
17 |
Correct |
5 ms |
5088 KB |
Output is correct |
18 |
Correct |
5 ms |
5112 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
4984 KB |
Output is correct |
2 |
Correct |
5 ms |
4984 KB |
Output is correct |
3 |
Correct |
5 ms |
5084 KB |
Output is correct |
4 |
Correct |
5 ms |
5112 KB |
Output is correct |
5 |
Correct |
4 ms |
4988 KB |
Output is correct |
6 |
Correct |
5 ms |
4984 KB |
Output is correct |
7 |
Correct |
5 ms |
4984 KB |
Output is correct |
8 |
Correct |
5 ms |
4984 KB |
Output is correct |
9 |
Correct |
5 ms |
5112 KB |
Output is correct |
10 |
Correct |
5 ms |
5112 KB |
Output is correct |
11 |
Correct |
5 ms |
5112 KB |
Output is correct |
12 |
Correct |
6 ms |
5112 KB |
Output is correct |
13 |
Correct |
5 ms |
5112 KB |
Output is correct |
14 |
Correct |
5 ms |
4984 KB |
Output is correct |
15 |
Correct |
5 ms |
4984 KB |
Output is correct |
16 |
Correct |
5 ms |
4984 KB |
Output is correct |
17 |
Correct |
5 ms |
5088 KB |
Output is correct |
18 |
Correct |
5 ms |
5112 KB |
Output is correct |
19 |
Correct |
5 ms |
4984 KB |
Output is correct |
20 |
Correct |
6 ms |
4984 KB |
Output is correct |
21 |
Correct |
17 ms |
5128 KB |
Output is correct |
22 |
Correct |
5 ms |
5112 KB |
Output is correct |
23 |
Correct |
5 ms |
5112 KB |
Output is correct |
24 |
Correct |
5 ms |
5112 KB |
Output is correct |
25 |
Correct |
14 ms |
5112 KB |
Output is correct |
26 |
Correct |
5 ms |
5112 KB |
Output is correct |
27 |
Correct |
5 ms |
5112 KB |
Output is correct |
28 |
Correct |
8 ms |
5112 KB |
Output is correct |
29 |
Correct |
12 ms |
5112 KB |
Output is correct |
30 |
Correct |
12 ms |
5112 KB |
Output is correct |
31 |
Correct |
14 ms |
5112 KB |
Output is correct |
32 |
Correct |
15 ms |
5160 KB |
Output is correct |
33 |
Correct |
14 ms |
5112 KB |
Output is correct |
34 |
Correct |
6 ms |
5112 KB |
Output is correct |
35 |
Correct |
6 ms |
5112 KB |
Output is correct |
36 |
Correct |
6 ms |
5112 KB |
Output is correct |
37 |
Correct |
13 ms |
5112 KB |
Output is correct |
38 |
Correct |
14 ms |
5112 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
4984 KB |
Output is correct |
2 |
Correct |
5 ms |
4984 KB |
Output is correct |
3 |
Correct |
5 ms |
5084 KB |
Output is correct |
4 |
Correct |
5 ms |
5112 KB |
Output is correct |
5 |
Correct |
4 ms |
4988 KB |
Output is correct |
6 |
Correct |
5 ms |
4984 KB |
Output is correct |
7 |
Correct |
5 ms |
4984 KB |
Output is correct |
8 |
Correct |
5 ms |
4984 KB |
Output is correct |
9 |
Correct |
5 ms |
5112 KB |
Output is correct |
10 |
Correct |
5 ms |
5112 KB |
Output is correct |
11 |
Correct |
5 ms |
5112 KB |
Output is correct |
12 |
Correct |
6 ms |
5112 KB |
Output is correct |
13 |
Correct |
5 ms |
5112 KB |
Output is correct |
14 |
Correct |
5 ms |
4984 KB |
Output is correct |
15 |
Correct |
5 ms |
4984 KB |
Output is correct |
16 |
Correct |
5 ms |
4984 KB |
Output is correct |
17 |
Correct |
5 ms |
5088 KB |
Output is correct |
18 |
Correct |
5 ms |
5112 KB |
Output is correct |
19 |
Execution timed out |
3047 ms |
11256 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 |
5 ms |
4984 KB |
Output is correct |
3 |
Correct |
5 ms |
5084 KB |
Output is correct |
4 |
Correct |
5 ms |
5112 KB |
Output is correct |
5 |
Correct |
4 ms |
4988 KB |
Output is correct |
6 |
Correct |
5 ms |
4984 KB |
Output is correct |
7 |
Correct |
5 ms |
4984 KB |
Output is correct |
8 |
Correct |
5 ms |
4984 KB |
Output is correct |
9 |
Correct |
5 ms |
5112 KB |
Output is correct |
10 |
Correct |
5 ms |
5112 KB |
Output is correct |
11 |
Correct |
5 ms |
5112 KB |
Output is correct |
12 |
Correct |
6 ms |
5112 KB |
Output is correct |
13 |
Correct |
5 ms |
5112 KB |
Output is correct |
14 |
Correct |
5 ms |
4984 KB |
Output is correct |
15 |
Correct |
5 ms |
4984 KB |
Output is correct |
16 |
Correct |
5 ms |
4984 KB |
Output is correct |
17 |
Correct |
5 ms |
5088 KB |
Output is correct |
18 |
Correct |
5 ms |
5112 KB |
Output is correct |
19 |
Correct |
5 ms |
4984 KB |
Output is correct |
20 |
Correct |
6 ms |
4984 KB |
Output is correct |
21 |
Correct |
17 ms |
5128 KB |
Output is correct |
22 |
Correct |
5 ms |
5112 KB |
Output is correct |
23 |
Correct |
5 ms |
5112 KB |
Output is correct |
24 |
Correct |
5 ms |
5112 KB |
Output is correct |
25 |
Correct |
14 ms |
5112 KB |
Output is correct |
26 |
Correct |
5 ms |
5112 KB |
Output is correct |
27 |
Correct |
5 ms |
5112 KB |
Output is correct |
28 |
Correct |
8 ms |
5112 KB |
Output is correct |
29 |
Correct |
12 ms |
5112 KB |
Output is correct |
30 |
Correct |
12 ms |
5112 KB |
Output is correct |
31 |
Correct |
14 ms |
5112 KB |
Output is correct |
32 |
Correct |
15 ms |
5160 KB |
Output is correct |
33 |
Correct |
14 ms |
5112 KB |
Output is correct |
34 |
Correct |
6 ms |
5112 KB |
Output is correct |
35 |
Correct |
6 ms |
5112 KB |
Output is correct |
36 |
Correct |
6 ms |
5112 KB |
Output is correct |
37 |
Correct |
13 ms |
5112 KB |
Output is correct |
38 |
Correct |
14 ms |
5112 KB |
Output is correct |
39 |
Execution timed out |
3047 ms |
11256 KB |
Time limit exceeded |
40 |
Halted |
0 ms |
0 KB |
- |