#include "swap.h"
#include <bits/stdc++.h>
using namespace std;
int i, mx;
bool visited[100005];
vector<int> adj[100005];
bool cycle;
void dfs(int x, int p=-1) {
visited[x] = true;
for (auto y : adj[x]) {
if (y == p) continue;
if (visited[y]) cycle = true;
else dfs(y, x);
}
}
void init(int N, int M, vector<int> U, vector<int> V, vector<int> W) {
for (i=0; i < M; ++i) {
adj[U[i]].push_back(V[i]);
adj[V[i]].push_back(U[i]);
}
cycle = false;
dfs(1);
mx = -1;
for (i=0; i < M; ++i) mx = max(mx, W[i]);
}
int getMinimumFuelCapacity(int X, int Y) {
return (cycle ? mx : -1);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2644 KB |
Output is correct |
2 |
Correct |
1 ms |
2644 KB |
Output is correct |
3 |
Correct |
2 ms |
2660 KB |
Output is correct |
4 |
Correct |
1 ms |
2644 KB |
Output is correct |
5 |
Correct |
2 ms |
2644 KB |
Output is correct |
6 |
Correct |
2 ms |
2672 KB |
Output is correct |
7 |
Correct |
2 ms |
2644 KB |
Output is correct |
8 |
Correct |
3 ms |
2664 KB |
Output is correct |
9 |
Correct |
38 ms |
11624 KB |
Output is correct |
10 |
Correct |
39 ms |
14136 KB |
Output is correct |
11 |
Correct |
37 ms |
12980 KB |
Output is correct |
12 |
Correct |
40 ms |
13432 KB |
Output is correct |
13 |
Correct |
39 ms |
14708 KB |
Output is correct |
14 |
Correct |
34 ms |
11212 KB |
Output is correct |
15 |
Correct |
80 ms |
17660 KB |
Output is correct |
16 |
Correct |
97 ms |
16584 KB |
Output is correct |
17 |
Correct |
83 ms |
17520 KB |
Output is correct |
18 |
Correct |
83 ms |
18076 KB |
Output is correct |
19 |
Correct |
43 ms |
9720 KB |
Output is correct |
20 |
Correct |
81 ms |
19744 KB |
Output is correct |
21 |
Correct |
88 ms |
19660 KB |
Output is correct |
22 |
Correct |
90 ms |
20448 KB |
Output is correct |
23 |
Correct |
124 ms |
20464 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2644 KB |
Output is correct |
2 |
Correct |
1 ms |
2644 KB |
Output is correct |
3 |
Incorrect |
67 ms |
13724 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2644 KB |
Output is correct |
2 |
Correct |
1 ms |
2644 KB |
Output is correct |
3 |
Correct |
2 ms |
2660 KB |
Output is correct |
4 |
Correct |
1 ms |
2644 KB |
Output is correct |
5 |
Correct |
2 ms |
2644 KB |
Output is correct |
6 |
Correct |
2 ms |
2672 KB |
Output is correct |
7 |
Correct |
2 ms |
2644 KB |
Output is correct |
8 |
Correct |
3 ms |
2664 KB |
Output is correct |
9 |
Incorrect |
1 ms |
2644 KB |
Output isn't correct |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
2644 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2644 KB |
Output is correct |
2 |
Correct |
1 ms |
2644 KB |
Output is correct |
3 |
Correct |
2 ms |
2660 KB |
Output is correct |
4 |
Correct |
1 ms |
2644 KB |
Output is correct |
5 |
Correct |
2 ms |
2644 KB |
Output is correct |
6 |
Correct |
2 ms |
2672 KB |
Output is correct |
7 |
Correct |
2 ms |
2644 KB |
Output is correct |
8 |
Correct |
3 ms |
2664 KB |
Output is correct |
9 |
Correct |
38 ms |
11624 KB |
Output is correct |
10 |
Correct |
39 ms |
14136 KB |
Output is correct |
11 |
Correct |
37 ms |
12980 KB |
Output is correct |
12 |
Correct |
40 ms |
13432 KB |
Output is correct |
13 |
Correct |
39 ms |
14708 KB |
Output is correct |
14 |
Correct |
34 ms |
11212 KB |
Output is correct |
15 |
Correct |
80 ms |
17660 KB |
Output is correct |
16 |
Correct |
97 ms |
16584 KB |
Output is correct |
17 |
Correct |
83 ms |
17520 KB |
Output is correct |
18 |
Correct |
83 ms |
18076 KB |
Output is correct |
19 |
Incorrect |
67 ms |
13724 KB |
Output isn't correct |
20 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
2644 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |