# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
68047 |
2018-08-15T19:53:48 Z |
KieranHorgan |
Race (IOI11_race) |
C++17 |
|
3000 ms |
46592 KB |
#pragma GCC optimize("Ofast")
#include "race.h"
#include <bits/stdc++.h>
using namespace std;
vector<pair<pair<int, int>, int>> AdjList[200000];
bitset<400000> done[100];
int best_path(int N, int K, int H[][2], int L[]) {
for(int i = 0; i+1 < N; i++) {
AdjList[H[i][0]].push_back({{L[i], H[i][1]}, i*2 });
AdjList[H[i][1]].push_back({{L[i], H[i][0]}, i*2+1});
}
queue<pair<pair<int, int>, pair<int, int>>> q;
for(int i = 0; i < N; i++)
q.push({{i, -1}, {0, 0}});
int u, p, d, s;
while(!q.empty()) {
u = q.front().first.first;
p = q.front().first.second;
d = q.front().second.first;
s = q.front().second.second;
q.pop();
for(auto v: AdjList[u]) {
if(v.first.second != p) {
if(d+v.first.first > K) continue;
if(d+v.first.first == K)
return s+1;
if(K <= 100) {
if(done[d+v.first.first][v.second])
continue;
done[d+v.first.first][v.second] = 1;
}
q.push({{v.first.second, u}, {d+v.first.first, s+1}});
}
}
}
return -1;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
5240 KB |
Output is correct |
2 |
Correct |
6 ms |
5360 KB |
Output is correct |
3 |
Correct |
6 ms |
5360 KB |
Output is correct |
4 |
Correct |
6 ms |
5360 KB |
Output is correct |
5 |
Correct |
7 ms |
5360 KB |
Output is correct |
6 |
Correct |
6 ms |
5532 KB |
Output is correct |
7 |
Correct |
6 ms |
5592 KB |
Output is correct |
8 |
Correct |
6 ms |
5620 KB |
Output is correct |
9 |
Correct |
6 ms |
5768 KB |
Output is correct |
10 |
Correct |
7 ms |
5768 KB |
Output is correct |
11 |
Correct |
6 ms |
5768 KB |
Output is correct |
12 |
Correct |
7 ms |
5800 KB |
Output is correct |
13 |
Correct |
7 ms |
5800 KB |
Output is correct |
14 |
Correct |
6 ms |
5800 KB |
Output is correct |
15 |
Correct |
6 ms |
5800 KB |
Output is correct |
16 |
Correct |
8 ms |
5800 KB |
Output is correct |
17 |
Correct |
10 ms |
5800 KB |
Output is correct |
18 |
Correct |
8 ms |
5828 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
5240 KB |
Output is correct |
2 |
Correct |
6 ms |
5360 KB |
Output is correct |
3 |
Correct |
6 ms |
5360 KB |
Output is correct |
4 |
Correct |
6 ms |
5360 KB |
Output is correct |
5 |
Correct |
7 ms |
5360 KB |
Output is correct |
6 |
Correct |
6 ms |
5532 KB |
Output is correct |
7 |
Correct |
6 ms |
5592 KB |
Output is correct |
8 |
Correct |
6 ms |
5620 KB |
Output is correct |
9 |
Correct |
6 ms |
5768 KB |
Output is correct |
10 |
Correct |
7 ms |
5768 KB |
Output is correct |
11 |
Correct |
6 ms |
5768 KB |
Output is correct |
12 |
Correct |
7 ms |
5800 KB |
Output is correct |
13 |
Correct |
7 ms |
5800 KB |
Output is correct |
14 |
Correct |
6 ms |
5800 KB |
Output is correct |
15 |
Correct |
6 ms |
5800 KB |
Output is correct |
16 |
Correct |
8 ms |
5800 KB |
Output is correct |
17 |
Correct |
10 ms |
5800 KB |
Output is correct |
18 |
Correct |
8 ms |
5828 KB |
Output is correct |
19 |
Correct |
8 ms |
5828 KB |
Output is correct |
20 |
Correct |
9 ms |
5828 KB |
Output is correct |
21 |
Correct |
26 ms |
7632 KB |
Output is correct |
22 |
Correct |
7 ms |
7632 KB |
Output is correct |
23 |
Correct |
10 ms |
7632 KB |
Output is correct |
24 |
Correct |
10 ms |
7632 KB |
Output is correct |
25 |
Correct |
42 ms |
7632 KB |
Output is correct |
26 |
Correct |
8 ms |
7632 KB |
Output is correct |
27 |
Correct |
7 ms |
7632 KB |
Output is correct |
28 |
Correct |
10 ms |
7632 KB |
Output is correct |
29 |
Correct |
16 ms |
7632 KB |
Output is correct |
30 |
Correct |
13 ms |
7632 KB |
Output is correct |
31 |
Correct |
22 ms |
7632 KB |
Output is correct |
32 |
Correct |
21 ms |
7632 KB |
Output is correct |
33 |
Correct |
20 ms |
7632 KB |
Output is correct |
34 |
Correct |
10 ms |
7632 KB |
Output is correct |
35 |
Correct |
10 ms |
7632 KB |
Output is correct |
36 |
Correct |
7 ms |
7632 KB |
Output is correct |
37 |
Correct |
15 ms |
7632 KB |
Output is correct |
38 |
Correct |
17 ms |
7632 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
5240 KB |
Output is correct |
2 |
Correct |
6 ms |
5360 KB |
Output is correct |
3 |
Correct |
6 ms |
5360 KB |
Output is correct |
4 |
Correct |
6 ms |
5360 KB |
Output is correct |
5 |
Correct |
7 ms |
5360 KB |
Output is correct |
6 |
Correct |
6 ms |
5532 KB |
Output is correct |
7 |
Correct |
6 ms |
5592 KB |
Output is correct |
8 |
Correct |
6 ms |
5620 KB |
Output is correct |
9 |
Correct |
6 ms |
5768 KB |
Output is correct |
10 |
Correct |
7 ms |
5768 KB |
Output is correct |
11 |
Correct |
6 ms |
5768 KB |
Output is correct |
12 |
Correct |
7 ms |
5800 KB |
Output is correct |
13 |
Correct |
7 ms |
5800 KB |
Output is correct |
14 |
Correct |
6 ms |
5800 KB |
Output is correct |
15 |
Correct |
6 ms |
5800 KB |
Output is correct |
16 |
Correct |
8 ms |
5800 KB |
Output is correct |
17 |
Correct |
10 ms |
5800 KB |
Output is correct |
18 |
Correct |
8 ms |
5828 KB |
Output is correct |
19 |
Correct |
381 ms |
25340 KB |
Output is correct |
20 |
Correct |
607 ms |
26980 KB |
Output is correct |
21 |
Correct |
515 ms |
28904 KB |
Output is correct |
22 |
Correct |
423 ms |
35900 KB |
Output is correct |
23 |
Correct |
95 ms |
35900 KB |
Output is correct |
24 |
Correct |
74 ms |
35900 KB |
Output is correct |
25 |
Correct |
809 ms |
35900 KB |
Output is correct |
26 |
Correct |
388 ms |
35900 KB |
Output is correct |
27 |
Correct |
482 ms |
44628 KB |
Output is correct |
28 |
Correct |
206 ms |
44628 KB |
Output is correct |
29 |
Correct |
175 ms |
44628 KB |
Output is correct |
30 |
Correct |
451 ms |
44672 KB |
Output is correct |
31 |
Correct |
457 ms |
44672 KB |
Output is correct |
32 |
Correct |
220 ms |
46592 KB |
Output is correct |
33 |
Execution timed out |
3042 ms |
46592 KB |
Time limit exceeded |
34 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
5240 KB |
Output is correct |
2 |
Correct |
6 ms |
5360 KB |
Output is correct |
3 |
Correct |
6 ms |
5360 KB |
Output is correct |
4 |
Correct |
6 ms |
5360 KB |
Output is correct |
5 |
Correct |
7 ms |
5360 KB |
Output is correct |
6 |
Correct |
6 ms |
5532 KB |
Output is correct |
7 |
Correct |
6 ms |
5592 KB |
Output is correct |
8 |
Correct |
6 ms |
5620 KB |
Output is correct |
9 |
Correct |
6 ms |
5768 KB |
Output is correct |
10 |
Correct |
7 ms |
5768 KB |
Output is correct |
11 |
Correct |
6 ms |
5768 KB |
Output is correct |
12 |
Correct |
7 ms |
5800 KB |
Output is correct |
13 |
Correct |
7 ms |
5800 KB |
Output is correct |
14 |
Correct |
6 ms |
5800 KB |
Output is correct |
15 |
Correct |
6 ms |
5800 KB |
Output is correct |
16 |
Correct |
8 ms |
5800 KB |
Output is correct |
17 |
Correct |
10 ms |
5800 KB |
Output is correct |
18 |
Correct |
8 ms |
5828 KB |
Output is correct |
19 |
Correct |
8 ms |
5828 KB |
Output is correct |
20 |
Correct |
9 ms |
5828 KB |
Output is correct |
21 |
Correct |
26 ms |
7632 KB |
Output is correct |
22 |
Correct |
7 ms |
7632 KB |
Output is correct |
23 |
Correct |
10 ms |
7632 KB |
Output is correct |
24 |
Correct |
10 ms |
7632 KB |
Output is correct |
25 |
Correct |
42 ms |
7632 KB |
Output is correct |
26 |
Correct |
8 ms |
7632 KB |
Output is correct |
27 |
Correct |
7 ms |
7632 KB |
Output is correct |
28 |
Correct |
10 ms |
7632 KB |
Output is correct |
29 |
Correct |
16 ms |
7632 KB |
Output is correct |
30 |
Correct |
13 ms |
7632 KB |
Output is correct |
31 |
Correct |
22 ms |
7632 KB |
Output is correct |
32 |
Correct |
21 ms |
7632 KB |
Output is correct |
33 |
Correct |
20 ms |
7632 KB |
Output is correct |
34 |
Correct |
10 ms |
7632 KB |
Output is correct |
35 |
Correct |
10 ms |
7632 KB |
Output is correct |
36 |
Correct |
7 ms |
7632 KB |
Output is correct |
37 |
Correct |
15 ms |
7632 KB |
Output is correct |
38 |
Correct |
17 ms |
7632 KB |
Output is correct |
39 |
Correct |
381 ms |
25340 KB |
Output is correct |
40 |
Correct |
607 ms |
26980 KB |
Output is correct |
41 |
Correct |
515 ms |
28904 KB |
Output is correct |
42 |
Correct |
423 ms |
35900 KB |
Output is correct |
43 |
Correct |
95 ms |
35900 KB |
Output is correct |
44 |
Correct |
74 ms |
35900 KB |
Output is correct |
45 |
Correct |
809 ms |
35900 KB |
Output is correct |
46 |
Correct |
388 ms |
35900 KB |
Output is correct |
47 |
Correct |
482 ms |
44628 KB |
Output is correct |
48 |
Correct |
206 ms |
44628 KB |
Output is correct |
49 |
Correct |
175 ms |
44628 KB |
Output is correct |
50 |
Correct |
451 ms |
44672 KB |
Output is correct |
51 |
Correct |
457 ms |
44672 KB |
Output is correct |
52 |
Correct |
220 ms |
46592 KB |
Output is correct |
53 |
Execution timed out |
3042 ms |
46592 KB |
Time limit exceeded |
54 |
Halted |
0 ms |
0 KB |
- |