#include "swap.h"
#include<bits/stdc++.h>
#include <vector>
#define pb push_back
using namespace std;
const int N = 1e6 + 5;
vector<pair<int, int> > g[N];
int mx, n, m;
bool sb2 = 1;
void init(int N, int M,
std::vector<int> U, std::vector<int> V, std::vector<int> W) {
n = N;
m = M;
for(int i = 0; i < M; ++i){
int u = U[i], v = V[i], w = W[i];
if(u != 0 and v != 0)
sb2 = false;
g[u].pb({v, w});
g[v].pb({u, w});
mx = max(mx, w);
}
}
int getMinimumFuelCapacity(int X, int Y) {
if(sb2 and m == n - 1){
int x = g[X][0].second, xx = g[Y][0].second, mn = INT_MAX;
for(auto k : g[0]){
if(k.first != X and k.first != Y)
mn = min(mn, k.second);
}
if(mn == INT_MAX) return -1;
return max({x, xx, mn});
}
if(m == n - 1)
return -1;
else
return mx;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
12 ms |
23764 KB |
Output is correct |
2 |
Correct |
12 ms |
23764 KB |
Output is correct |
3 |
Correct |
14 ms |
23768 KB |
Output is correct |
4 |
Correct |
15 ms |
23764 KB |
Output is correct |
5 |
Correct |
15 ms |
23764 KB |
Output is correct |
6 |
Correct |
13 ms |
23836 KB |
Output is correct |
7 |
Correct |
13 ms |
23728 KB |
Output is correct |
8 |
Correct |
13 ms |
23764 KB |
Output is correct |
9 |
Correct |
47 ms |
27992 KB |
Output is correct |
10 |
Correct |
58 ms |
29004 KB |
Output is correct |
11 |
Correct |
70 ms |
28876 KB |
Output is correct |
12 |
Correct |
58 ms |
29188 KB |
Output is correct |
13 |
Correct |
68 ms |
29216 KB |
Output is correct |
14 |
Correct |
74 ms |
28156 KB |
Output is correct |
15 |
Correct |
118 ms |
30848 KB |
Output is correct |
16 |
Correct |
140 ms |
30748 KB |
Output is correct |
17 |
Correct |
124 ms |
30988 KB |
Output is correct |
18 |
Correct |
124 ms |
31028 KB |
Output is correct |
19 |
Correct |
68 ms |
28040 KB |
Output is correct |
20 |
Correct |
121 ms |
32032 KB |
Output is correct |
21 |
Correct |
123 ms |
32084 KB |
Output is correct |
22 |
Correct |
125 ms |
32400 KB |
Output is correct |
23 |
Correct |
138 ms |
32352 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
12 ms |
23764 KB |
Output is correct |
2 |
Correct |
12 ms |
23764 KB |
Output is correct |
3 |
Execution timed out |
2058 ms |
31156 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
12 ms |
23764 KB |
Output is correct |
2 |
Correct |
12 ms |
23764 KB |
Output is correct |
3 |
Correct |
14 ms |
23768 KB |
Output is correct |
4 |
Correct |
15 ms |
23764 KB |
Output is correct |
5 |
Correct |
15 ms |
23764 KB |
Output is correct |
6 |
Correct |
13 ms |
23836 KB |
Output is correct |
7 |
Correct |
13 ms |
23728 KB |
Output is correct |
8 |
Correct |
13 ms |
23764 KB |
Output is correct |
9 |
Incorrect |
15 ms |
23768 KB |
Output isn't correct |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
15 ms |
23768 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
12 ms |
23764 KB |
Output is correct |
2 |
Correct |
12 ms |
23764 KB |
Output is correct |
3 |
Correct |
14 ms |
23768 KB |
Output is correct |
4 |
Correct |
15 ms |
23764 KB |
Output is correct |
5 |
Correct |
15 ms |
23764 KB |
Output is correct |
6 |
Correct |
13 ms |
23836 KB |
Output is correct |
7 |
Correct |
13 ms |
23728 KB |
Output is correct |
8 |
Correct |
13 ms |
23764 KB |
Output is correct |
9 |
Correct |
47 ms |
27992 KB |
Output is correct |
10 |
Correct |
58 ms |
29004 KB |
Output is correct |
11 |
Correct |
70 ms |
28876 KB |
Output is correct |
12 |
Correct |
58 ms |
29188 KB |
Output is correct |
13 |
Correct |
68 ms |
29216 KB |
Output is correct |
14 |
Correct |
74 ms |
28156 KB |
Output is correct |
15 |
Correct |
118 ms |
30848 KB |
Output is correct |
16 |
Correct |
140 ms |
30748 KB |
Output is correct |
17 |
Correct |
124 ms |
30988 KB |
Output is correct |
18 |
Correct |
124 ms |
31028 KB |
Output is correct |
19 |
Execution timed out |
2058 ms |
31156 KB |
Time limit exceeded |
20 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
15 ms |
23768 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |