#include <bits/stdc++.h>
#include "swap.h"
using namespace std;
using ll = long long;
const int maxn = 1e5 + 10;
int n;
vector<pair<ll,int>> g[maxn];
bool loop = false;
ll maxW = 0;
void dfs(int at, int p, int dep) {
if (dep==n) {
loop=true;
return;
}
for (auto ed: g[at]) {
int to = ed.second;
if (to == p) continue;
dfs(to,at,dep+1);
}
}
void init(int N, int M, std::vector<int> U, std::vector<int> V, std::vector<int> W) {
n=N;
for (int i=0; i<M; i++) {
g[U[i]].push_back({W[i],V[i]});
g[V[i]].push_back({W[i],U[i]});
maxW=max(maxW,1ll*W[i]);
}
dfs(0,-1,0);
}
int getMinimumFuelCapacity(int X, int Y) {
if (loop) return maxW;
return -1;
}
/*
int main() {
init(4,4,{0,1,2,3},{1,2,3,0},{1,1,1,1});
cout<<getMinimumFuelCapacity(1, 2)<<endl;
// init(5, 6, {0, 0, 1, 1, 1, 2}, {1, 2, 2, 3, 4, 3}, {4, 4, 1, 2, 10, 3});
// cout<<getMinimumFuelCapacity(1, 2)<<endl;
// cout<<getMinimumFuelCapacity(2, 4)<<endl;
// cout<<getMinimumFuelCapacity(0, 1)<<endl;
return 0;
}
*/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
2668 KB |
Output is correct |
2 |
Correct |
2 ms |
2668 KB |
Output is correct |
3 |
Correct |
2 ms |
2668 KB |
Output is correct |
4 |
Correct |
2 ms |
2668 KB |
Output is correct |
5 |
Correct |
2 ms |
2796 KB |
Output is correct |
6 |
Correct |
2 ms |
2796 KB |
Output is correct |
7 |
Correct |
3 ms |
2796 KB |
Output is correct |
8 |
Correct |
3 ms |
2796 KB |
Output is correct |
9 |
Correct |
60 ms |
10860 KB |
Output is correct |
10 |
Correct |
78 ms |
13548 KB |
Output is correct |
11 |
Correct |
83 ms |
13164 KB |
Output is correct |
12 |
Correct |
87 ms |
13804 KB |
Output is correct |
13 |
Correct |
83 ms |
14828 KB |
Output is correct |
14 |
Correct |
66 ms |
10604 KB |
Output is correct |
15 |
Correct |
156 ms |
15224 KB |
Output is correct |
16 |
Correct |
145 ms |
13980 KB |
Output is correct |
17 |
Correct |
153 ms |
16596 KB |
Output is correct |
18 |
Correct |
155 ms |
15828 KB |
Output is correct |
19 |
Correct |
67 ms |
8044 KB |
Output is correct |
20 |
Correct |
169 ms |
21868 KB |
Output is correct |
21 |
Correct |
161 ms |
21668 KB |
Output is correct |
22 |
Correct |
180 ms |
22484 KB |
Output is correct |
23 |
Correct |
174 ms |
22480 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
2668 KB |
Output is correct |
2 |
Correct |
2 ms |
2668 KB |
Output is correct |
3 |
Incorrect |
108 ms |
11008 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
2668 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
2668 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
2668 KB |
Output is correct |
2 |
Correct |
2 ms |
2668 KB |
Output is correct |
3 |
Correct |
2 ms |
2668 KB |
Output is correct |
4 |
Correct |
2 ms |
2668 KB |
Output is correct |
5 |
Correct |
2 ms |
2796 KB |
Output is correct |
6 |
Correct |
2 ms |
2796 KB |
Output is correct |
7 |
Correct |
3 ms |
2796 KB |
Output is correct |
8 |
Correct |
3 ms |
2796 KB |
Output is correct |
9 |
Correct |
60 ms |
10860 KB |
Output is correct |
10 |
Correct |
78 ms |
13548 KB |
Output is correct |
11 |
Correct |
83 ms |
13164 KB |
Output is correct |
12 |
Correct |
87 ms |
13804 KB |
Output is correct |
13 |
Correct |
83 ms |
14828 KB |
Output is correct |
14 |
Correct |
66 ms |
10604 KB |
Output is correct |
15 |
Correct |
156 ms |
15224 KB |
Output is correct |
16 |
Correct |
145 ms |
13980 KB |
Output is correct |
17 |
Correct |
153 ms |
16596 KB |
Output is correct |
18 |
Correct |
155 ms |
15828 KB |
Output is correct |
19 |
Incorrect |
108 ms |
11008 KB |
Output isn't correct |
20 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
2668 KB |
Output isn't correct |