#include "swap.h"
#include <vector>
#include <algorithm>
using namespace std;
const int MAXN = 1e5 + 123;
vector<pair<int, int>> edg[MAXN];
void init(int n, int m, vector<int> U, vector<int> V, vector<int> W) {
vector<pair<int, pair<int, int>>> edg_weight(m);
for (int i = 0; i < m; ++i) {
edg_weight[i] = {W[i], {U[i], V[i]}};
}
sort(edg_weight.begin(), edg_weight.end());
for (auto [w, e] : edg_weight) {
auto [u, v] = e;
edg[u].push_back({v, w});
edg[v].push_back({u, w});
}
}
int getMinimumFuelCapacity(int X, int Y) {
if (edg[0].size() < 3)
return -1;
if (X == 0) {
return max(edg[0][2].second, edg[Y][0].second);
}
if (Y == 0)
return getMinimumFuelCapacity(Y, X);
return max({edg[0][2].second, edg[X][0].second, edg[Y][0].second});
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2528 KB |
Output is correct |
2 |
Correct |
1 ms |
2516 KB |
Output is correct |
3 |
Correct |
1 ms |
2516 KB |
Output is correct |
4 |
Correct |
2 ms |
2644 KB |
Output is correct |
5 |
Correct |
2 ms |
2644 KB |
Output is correct |
6 |
Correct |
2 ms |
2644 KB |
Output is correct |
7 |
Correct |
2 ms |
2652 KB |
Output is correct |
8 |
Correct |
2 ms |
2652 KB |
Output is correct |
9 |
Correct |
42 ms |
8088 KB |
Output is correct |
10 |
Correct |
58 ms |
9312 KB |
Output is correct |
11 |
Correct |
60 ms |
9132 KB |
Output is correct |
12 |
Correct |
60 ms |
9548 KB |
Output is correct |
13 |
Correct |
63 ms |
9548 KB |
Output is correct |
14 |
Correct |
45 ms |
8280 KB |
Output is correct |
15 |
Correct |
105 ms |
10864 KB |
Output is correct |
16 |
Correct |
110 ms |
10700 KB |
Output is correct |
17 |
Correct |
118 ms |
11144 KB |
Output is correct |
18 |
Correct |
110 ms |
11124 KB |
Output is correct |
19 |
Incorrect |
55 ms |
6072 KB |
Output isn't correct |
20 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2528 KB |
Output is correct |
2 |
Correct |
1 ms |
2516 KB |
Output is correct |
3 |
Correct |
115 ms |
11500 KB |
Output is correct |
4 |
Correct |
109 ms |
15520 KB |
Output is correct |
5 |
Correct |
110 ms |
15844 KB |
Output is correct |
6 |
Correct |
112 ms |
15384 KB |
Output is correct |
7 |
Correct |
109 ms |
15804 KB |
Output is correct |
8 |
Correct |
109 ms |
15336 KB |
Output is correct |
9 |
Correct |
114 ms |
15544 KB |
Output is correct |
10 |
Correct |
118 ms |
15420 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2528 KB |
Output is correct |
2 |
Correct |
1 ms |
2516 KB |
Output is correct |
3 |
Correct |
1 ms |
2516 KB |
Output is correct |
4 |
Correct |
2 ms |
2644 KB |
Output is correct |
5 |
Correct |
2 ms |
2644 KB |
Output is correct |
6 |
Correct |
2 ms |
2644 KB |
Output is correct |
7 |
Correct |
2 ms |
2652 KB |
Output is correct |
8 |
Correct |
2 ms |
2652 KB |
Output is correct |
9 |
Incorrect |
2 ms |
2644 KB |
Output isn't correct |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
2644 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2528 KB |
Output is correct |
2 |
Correct |
1 ms |
2516 KB |
Output is correct |
3 |
Correct |
1 ms |
2516 KB |
Output is correct |
4 |
Correct |
2 ms |
2644 KB |
Output is correct |
5 |
Correct |
2 ms |
2644 KB |
Output is correct |
6 |
Correct |
2 ms |
2644 KB |
Output is correct |
7 |
Correct |
2 ms |
2652 KB |
Output is correct |
8 |
Correct |
2 ms |
2652 KB |
Output is correct |
9 |
Correct |
42 ms |
8088 KB |
Output is correct |
10 |
Correct |
58 ms |
9312 KB |
Output is correct |
11 |
Correct |
60 ms |
9132 KB |
Output is correct |
12 |
Correct |
60 ms |
9548 KB |
Output is correct |
13 |
Correct |
63 ms |
9548 KB |
Output is correct |
14 |
Correct |
45 ms |
8280 KB |
Output is correct |
15 |
Correct |
105 ms |
10864 KB |
Output is correct |
16 |
Correct |
110 ms |
10700 KB |
Output is correct |
17 |
Correct |
118 ms |
11144 KB |
Output is correct |
18 |
Correct |
110 ms |
11124 KB |
Output is correct |
19 |
Correct |
115 ms |
11500 KB |
Output is correct |
20 |
Correct |
109 ms |
15520 KB |
Output is correct |
21 |
Correct |
110 ms |
15844 KB |
Output is correct |
22 |
Correct |
112 ms |
15384 KB |
Output is correct |
23 |
Correct |
109 ms |
15804 KB |
Output is correct |
24 |
Correct |
109 ms |
15336 KB |
Output is correct |
25 |
Correct |
114 ms |
15544 KB |
Output is correct |
26 |
Correct |
118 ms |
15420 KB |
Output is correct |
27 |
Incorrect |
2 ms |
2644 KB |
Output isn't correct |
28 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
2644 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |